Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support Teams Worldwide

Collect a series of traces automatically with Dynamics AX 2012

Introduction

The following steps are one way to collect a series of AX traces on a schedule with all versions of AX 2012 on the AOS server, using standard Windows tools: Perfmon combined with Task Scheduler. This example collects a 1 minute trace at 5 minute intervals.

This can be useful for example if you want to trace a long running process such as a job that runs for hours, to get snapshots of the end to end process before narrowing down into more granular analysis.

The trace files can then be renamed and imported into Trace Parser to analyse the code and queries.

Due to the potential number and size of files generated (dependent on the process being traced), it is recommended that this is done on a test environment and that disk usage is monitored.

Disclaimer: Microsoft provides examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. These steps assume that you are familiar with the technologies that are being demonstrated and the tools that are used to create and debug procedures. 

Steps

1. Follow the blog post below to set up a data collector set in Perfmon and name it “AXTrace”.
http://blogs.msdn.com/b/axperf/archive/2011/11/18/collect-ax-2012-event-traces-with-windows-performance-monitor.aspx 

 

2. Add a stop condition in the properties of your data collector set, of 1 minute overall duration.

 

3. Start the task scheduler, e.g. by entering taskschd.msc in the run command.

4. You will create a task to run your data collector set every 5 minutes on demand. First choose ‘Create Basic Task…’.

 

5. Give your task a name, click Next.


 
6. Keep the default start date/time, click Next.

7. Choose ‘Start a program’.


 
8. In ‘Program/script’, enter ‘logman’. In ‘Add arguments’ enter ‘start “AXTrace”’.
 

 

  
9. Tick ‘Open the Properties dialog when I click Finish’. Click Finish.


 
10. In the properties, on the General tab, select ‘Run whether the user is logged on or not’, tick ‘Do not store password’ and ‘Run with highest privileges’.
 

 


11. On the triggers tab, click ‘Edit’.


 
12. Tick ‘Repeat task every:’ and choose ‘5 minutes’. Press OK, then OK again.
 


13. Back in the main Task Scheduler window, right click on your task, then click Disable (to leave it disabled until you want to trace the process in AX).
 

 
14. Click ‘Run’ when you’re ready to trace your process in AX.


 
15. The data collector set should be running (for 1 minute, every 5 minutes) as depicted by a green arrow (A) and there should be a folder created for each 1 minute trace (B), each containing a file named ‘DataCollector01.etl’ (C).
 

Default path is C:\PERFLOGS\[Username]\AXTrace (or you can find the path from the Output field in perfmon: see screenshot A above).

16. After running the process in AX, click ‘End’.