- 0 minutes to read

How to enable the WCF Diagnostics Tracing Feature

Learn how to enable WCF Diagnostics to enable Logging with Nodinite. To enable WCF Diagnostics logging, follow the steps below.

First, make sure you comply with the prerequisites.

Important

Configure Message Types for business intelligence

When configuring WCF Diagnostics Tracing, you must set DefaultMessageType and MessageTypeFromBody properties to enable Message Types. Without Message Types:

Follow the steps below to configure these critical properties in your WCF application's config file.

Enable Logging

Repeat the steps as required to enable logging for multiple WCF applications.

Step 1: Copy files from ZIP

If you already performed this step during the installation, then go to the next step. Otherwise, copy the files from the ZIP package, and make sure Windows does not block them.

Step 2: Edit configuration section

Open your web/app.config and add/modify the <system.diagnostics> section as detailed below:

Note

The Nodinite Pickup Log Events Service Logging Agent consumes the output files. Make sure to set the PickupFolder and the LogAgentId property to identify logging into the Nodinite Log API.

Required

  • PickupFolder - Folder where to write the WCF Diagnostics output files, for example C:\Temp\Nodinite.LogAgent.WCFDiagnostics42.
  • LogAgentId - The unique LogAgentId, see Log Agents for additional details, for example 42.

Critical for Business Intelligence

  • DefaultMessageType - Default Message Type for all WCF messages. Set to a meaningful business transaction name (e.g., "OrderService#1.0", "CustomerAPI#2.0"). This enables Search Field Expressions to extract business data. If MessageTypeFromBody = true, this is used as fallback when extraction fails. Default: "IM.LogAgent.WCFDiagnostics/1.0#DefaultMessageType" (not recommended - use a business-meaningful name instead)
  • MessageTypeFromBody - When true, automatically extracts Message Type from WCF message body using XPath /MessageLogTraceRecord/Envelope/Body (namespace#node). Useful when WCF applications handle multiple message types. Falls back to DefaultMessageType if extraction fails. Default: false

Tip

Choosing between DefaultMessageType and MessageTypeFromBody:

  • Single WCF service handling one message type: Set DefaultMessageType to your business transaction name (e.g., "OrderService#1.0") and leave MessageTypeFromBody = false
  • WCF service handling multiple message types: Set MessageTypeFromBody = true and provide a meaningful DefaultMessageType as fallback (e.g., "GenericWCFService#1.0")

After configuration, define Message Types in Nodinite Administration and configure Search Field Expressions to extract business data.

<system.diagnostics>
  <sources>
    <source name="System.ServiceModel" switchValue="Information, ActivityTracing">
      <listeners>
        <add name="Nodinite.LogAgent.WCFDiagnostics" />
      </listeners>
    </source>
    <source name="System.ServiceModel.MessageLogging" switchValue="Information, ActivityTracing">
      <listeners>
        <add name="Nodinite.LogAgent.WCFDiagnostics" />
      </listeners>
    </source>
  </sources>
  <sharedListeners>
    <add type="Nodinite.LogAgent.WCFDiagnostics.EventJsonWriterTraceListener, Nodinite.LogAgent.WCFDiagnostics" name="Nodinite.LogAgent.WCFDiagnostics" traceOutputOptions="None" PickupFolder="C:\Temp\Nodinite.LogAgent.WCFDiagnostics42" LogAgentId="42" DefaultMessageType="" MessageTypeFromBody="true" DefaultEndPointName="" DefaultEndPointUri="" IncomingEventTimeout="10">
      <filter type="" />
    </add>
  </sharedListeners>
  <trace autoflush="true" />
</system.diagnostics>

* name - should not be changed. If you do change it you need to replace all occurrences:

Step 3: Edit system.serviceModel section

Open your web/app.config and add/modify <system.serviceModel> section.

<diagnostics>
  <messageLogging
    logEntireMessage="true"
    logMalformedMessages="true"
    logMessagesAtServiceLevel="true"
    logMessagesAtTransportLevel="true"
    maxMessagesToLog="100000000"
    maxSizeOfMessageToLog="536870912"
  />
</diagnostics>

Step 4: Configure Newtonsoft version

Make sure to set the correct version of the Newtonsoft dll in the attribute newVersion, 9.0.0.0 is default with the downloaded version. Open your web/app.config and add/modify <configuration> section.

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="9.0.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

Step 5: Save

Note

Make sure to save changes when done.

Step 6: Configure Pickup Service

Now install and configure the Nodinite Pickup Log Events Service Logging Agent to fetch log files from the PickupFolder and log to the Nodinite Log API:

Step 7: Configure Log Views

Now Add or manage Log Views and use the Log Views to view the WCF Diagnostic output.

Step 8: Configure Message Types

Define Message Types in Nodinite Administration that correspond to your DefaultMessageType configuration:

  1. Navigate to Administration > Log Management > Message Types
  2. Create a new Message Type matching your DefaultMessageType (e.g., "OrderService#1.0")
  3. Set the Message Type name to match the namespace and root element of your WCF messages
  4. Provide a meaningful description for business users

Note

Message Types are mandatory for enabling Search Field extraction. Without Message Types, you cannot configure Search Field Expressions to extract business data from WCF messages.

Step 9: Configure Search Field Expressions

Configure Search Field Expressions to extract business-critical data from your WCF messages:

  1. Navigate to Administration > Log Management > Search Fields
  2. Create Search Field Expressions for your Message Type using:
    • XPath - For XML WCF messages (e.g., /Order/OrderId, /Customer/CustomerNumber)
    • JSON Path - For JSON WCF messages (e.g., $.order.orderId, $.customer.customerNumber)
    • RegEx - For text-based WCF messages or complex patterns
  3. Test expressions against sample WCF messages
  4. Assign expressions to appropriate Message Types

This enables business users to search WCF logs by Order IDs, Customer Numbers, Invoice Numbers, and other business-critical data.

Step 10: Configure Non-Events Monitoring (Optional)

Set up Non-Events Monitoring to detect missing WCF transactions or data outages:

  1. Navigate to Administration > Log Management > Non-Events Monitoring
  2. Create monitoring rules for your WCF Message Types
  3. Define expected message volumes and time windows
  4. Configure alerts using Alarm Plugins

This proactively alerts you when WCF messages are missing or volumes drop unexpectedly.

Step 11: Design BPM Processes (Optional)

Use Business Process Modeling (BPM) to correlate WCF transactions end-to-end across your applications and systems:

  1. Navigate to Administration > BPM
  2. Design business process flows that include your WCF services
  3. Define correlation rules using Search Fields (Order IDs, Transaction IDs, etc.)
  4. Map WCF Message Types to process steps
  5. Enable end-to-end transaction tracking

This provides complete visibility into business transactions flowing through your WCF applications and other systems.


Next Step

Complete these steps to unlock business intelligence for your WCF applications:

  1. Message Types – Define business transaction types in Nodinite Administration (Critical first step)
  2. Search Field Expressions – Configure extraction of business data from WCF messages
  3. Log Views – Create views for self-service access to WCF diagnostic data
  4. Non-Events Monitoring (Optional) – Set up alerts for missing WCF transactions
  5. Business Process Modeling (BPM) (Optional) – Design end-to-end transaction flows