BizTalk Server: Enabling ETW for BizTalk Applications in a Constrained Production Environment
Introduction
It is good practice to instrument BizTalk applications using the BizTalk CAT Instrumentation Framework. This framework uses Event Tracing for Windows (ETW) and provides code that you can use to provide feedback from your running applications for most BizTalk artefacts such as pipeline components, maps, orchestrations, etc.
The framework comes packaged as a DLL that can be installed in the Global Assembly Cache on target machines.
The framework also includes two applications, TRACELOG.EXE and TRACEFMT.EXE plus two command files that can be used with these to start and stop tracing, and format the output to a text file. NOTE: TRACEFMT.EXE also relies on 2 supplementary files, TRACEPRT.DLL and DEFAULT.TMF.
There is a community written application, the BizTalk CAT Instrumentation Framework Controller that provides a user interface which makes it easy to enable and disable tracing for applications.
However, in a highly controlled environment it may not be possible to include any of these applications due to server compliance rules and so an alternative method to create the log files generated by the framework is required.
Problem
You work in an environment where you are not allowed to install third party applications in the production environment, but you still need to be able to enable and disable tracing for your BizTalk application.
Solution
LOGMAN is an application that is included with the Windows operating system that enables the collection of trace and log information, including information produced by ETW instrumented applications.
Since it is part of the operating system there is no issue with using bundled applications.
The BizTalk CAT Instrumentation Framework Controller provides a mechanism by which it is possible to enable tracing for only part of the framework, for instance Pipeline Components, by specifying the trace providers only for those parts of interest.
In order to get the best level of control when the Controller is not available on a Production server it must also be possible to selectively include or exclude any given provider.
Starting Tracing
To start tracing for a specific trace provider, the following command can be issued from a command line.
logman start pipeline -bs 64 -ft 1 -rt -p "{691cb4cb-d20c-408e-8cff-fd8a01cd2f75}" 0xFFFF -o pipeline.etl -ets
This enables the trace provider for pipeline components, and the 0xFFFF switch tells the collector to include ALL events. Events are stored in the file specified by the –o switch. To start tracing for more than one provider a list of providers can be provided in a text file.
Issuing the following command from a prompt will then enable tracing for the components specified in the file.
logman start btstrace -bs 64 -ft 1 -rt -pf biztalktracing.txt -o mytracenew.etl –ets
where biztalktracing.txt is the file containing the list of components.
Stopping Tracing
Once sufficient information has been gathered the tracing can be stopped by issuing the following command.
logman stop btstrace –ets
Issuing this command closes the output file so that it can be moved elsewhere for further analysis.
Generate Text File
Once tracing is complete, the trace output file needs to be processed to produce a readable format. Since the assumption is that external tools are not allowed, the file needs to be copied to another machine that has the TRACEFMT tool available.
Once transferred issuing the following command produces a text output file.
tracefmt mytracenew.etl -o mytracenew.txt -tmf default.tmf
This produces output similar to that shown below.
Conclusion
In this article we have described a method that makes it possible to continue to use the good practice approach for tracing in a BizTalk application when in a constrained server environment.
Use of operating system tools ensures that tracing will always be possible regardless of server compliance rules.
References
- Best Practices for Instrumenting High Performance BizTalk Solutions
- BizTalk CAT Instrumentation Framework Controller
- Logman Event Trace Session Tool
- CLR ETW Keywords and Levels
See Also
Another important place to find an extensive amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki.