Total Pageviews

Search This Blog

Friday, September 23, 2011

Tracing Dynamics AX 2012 Events with Windows Event Tracing


A whitepaper has been released which walks us through the new Windows Event Tracing in Microsoft Dynamics AX 2012

In Microsoft Dynamics AX 2012, functionality to support tracing throughout the product has been added.

It's good to know how standard windows tools are available to accomplish tracing of some of the following feature areas in Dynamics AX 2012:
  • Data Access
  • Security
  • EP
  • MRP
  • ...

The steps (along with screenshots) mentioned in the whitepaper below helps one to easily setup Windows Event Tracing for Dynamics AX 2012. I did setup the Tracing on my Win 7 laptop which has AX 2012 running on it.

Some of the key points in setting up tracing are:

  Using Performance Monitor to record traces by setting up Data Collector (Read Pg 3 to Pg 10
   in the whitepaper which takes you through the steps of setting up data collector for tracing)

    We all know about Perfmon since Windows XP days to monitor and troubleshoot performance   

  •     Start New Data Collector Wizard
  •     Setup Event trace data
  •     Select Event Trace Provider (In this case, we will select Microsoft-DynamicsAX-Tracing)
  •     Setup the properties
  •     Start Data Collector

Using LogMan to record traces

Now, Logman is another out of the box windows utility to manage event trace sessions. Read more about it here

Using XPerf tool to record traces

XPerf.exe is a command-line tool that is distributed as part of the Windows Performance Analysis toolkit in the Windows SDK. It can be used to control and process trace data. This tool is especially useful for recording information about Windows kernel activity along with Microsoft Dynamic AX events.

Now, unlike perfmon and logman, XPerf doesn't come out of the box with Windows and nothing has been mentioned in the whitepaper regarding how and where to download it.

I did some googling to find a very useful blog which took me through a shortcut so I just installed the required SDK tools for XPerf and not the entire toolkit which saved me from downloading gigabytes of data.

  •  First, navigate to this website -
  •  Download the SDK which is less than 500k.
  •  Once downloaded, install the SDK by selecting only Win 32 Development tools (as shown in  this blog
  • Go to default path, i.e. C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin (or the corresponding path where you installed the SDK in your machine) and install wpt_x64.msi (64-bit) if you are running on 64-bit machine.

Now, you should be able to start using XPerf.

Use Event Viewer to view Traces (Pg 14)

Any tool that can process events created by using the Windows Events framework can be used to view Microsoft Dynamics AX event traces e.g. Event Viewer

Triggering Tasks on Events (Pg 15)

Events that are generated by Microsoft Dynamics AX can be used to trigger tasks in Windows Task Scheduler. For example, this functionality can be used to inform the administrator when a certain event happens, to start detailed diagnostic tracing, or to restart failing services

Instrument Custom Application Code (Pg 19)

In addition to built-in instrumentation, Microsoft Dynamics AX exposes several methods that allow solutions to be built on top of it to create basic events. The methods can be found in the xClassTrace class exposed to X++.
To instrument custom application code, you only need to add method calls that log messages you are interested in. After that, tracing can be configured by using standard tools as described earlier with no additional coding. 

Download Dynamics AX 2012 Windows Event Tracing Whitepaper

No comments: