Biztalk Diagnostics Library
A library providing functions for tracing, logging and generating WMI events from within a Biztalk orchestration
UsageThe library contains a Logger class with the following methods that can be used from an Expression or Message Assignment shape with any orchestration.
- TraceStartOrchestration()
- TraceMessage(XLANGMessage message)
- TraceEvent(string format, params object[] args)
- LogErrorEvent(string format, params object[] args)
- LogWarning(string format, params object[] args)
- LogException(Exception exception)
- LogMessage(XLANGMessage messageInError)
- LogSoapFault(XLANGMessage faultMessage)
- TraceEndOrchestration()
TraceListeners
- XmlTraceListener will write all events into an Xml trace file. The trace file is accessible using the Service Trace Viewer Tool http://msdn.microsoft.com/en-us/library/ms732023.aspx and each traced message is assigned to an activity that represents it's orchestration instance. By default the trace files are written to C:\temp, but this can be changed in the config. This listener limits the size and or age of the file, each trace file is prepended with a date time stamp and is limited to 10MB or an age of 24 hours before the file is closed and a new file is opened.
- LogEventListener will write each event with a severity of Warning or Error into the Application Event Log with a source of BizTalk Orchestration
- WMIEventListener will publish each event with a severity of Error as a TKH_BiztalkEvent in the root\TKHBiztalk namespace
ConfigurationThe following is added to the
BTSSvc.exe.config file
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<trace autoflush="true" indentsize="4" />
<sources>
<source name="BizTalk Orchestration" switchValue="Information">
<listeners>
<add name="BiztalkTrace" />
<add name="BiztalkLog" />
<add name="BiztalkWMIEvents" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="BiztalkTrace" initializeData="c:\temp\BTSOrchestrationTrace.svclog" type="TKH.Biztalk.Diagnostics.XmlTraceListener, TKH.Biztalk.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=ffa136ffa32ad91e" traceOutputOptions="Timestamp" />
<add name="BiztalkLog" type="TKH.Biztalk.Diagnostics.EventLogListener, TKH.Biztalk.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=ffa136ffa32ad91e" traceOutputOptions="Timestamp" />
<add name="BiztalkWMIEvents" type="TKH.Biztalk.Diagnostics.WMIEventListener, TKH.Biztalk.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=ffa136ffa32ad91e" traceOutputOptions="Timestamp" />
</sharedListeners>
</system.diagnostics>
</configuration>
To disable tracing, simply remove <add name="BiztalkTrace" /> from the list of listeners.
Be sure to create a C:\temp directoryYou may have to give the Biztalk Application Users group (or equivalent) full control of the following registry key: {HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog}