In part 1 of this series, we covered the basic prerequisites of taking a trace. In this post I'm going to cover some best practices around capturing trace data and how to troubleshoot some common issues that may prevent trace files from being created. The steps below apply to both Dynamics AX 2009 and Dynamics AX 4.0. In part 3 we will be covering the steps necessary to load and review a trace using the Trace Parser tool available on CustomerSource.
There's also a video you might want to check out that goes well with the content covered below.
Video: How to collect a trace within Dynamics AX
AX Tracing Best Practices
- There can be noticeable overhead associated with this type of application tracing, so it's best to not trace in a production environment. If you need to trace in a production environment, the best way to ensure other users are not negatively affected by this activity is to use a dedicated AOS for your tracing, or trace when other activity is at a minimum.
- Be as specific as possible when minimizing the size of the trace files and any unnecessary background noise that may be recorded outside of the specific process you're interested in.
- Tracing on a "cold" system can introduce some unnecessary background noise such as things that only happen once at client startup or form load and are then cached. This can distract from the main issue being analyzed, so it's best to warm up the system first before capturing a trace. Step through the scenario you want to trace once end-to-end, then start the trace and step through the scenario again.
- When tracing client activity, it is best to only have one instance of the Dynamics AX client open. Close all other instances and perform all actions through one client instance only.
AX Tracing Checklist
- Verify that the server configuration and client configuration utilities are setup to allow tracing, and the appropriate values are being captured as covered in part 1 of the series.
- Prior to starting the trace, warm up the system (prime the cache) by opening the Dynamics AX client and stepping through the scenario you want to trace once end-to-end.
- Because client tracing settings are dependent on the HKCU registry settings discussed in part 1 of the series, we recommend you launch the client from the Start Menu while logged into Windows as the user whose activity will be traced.
- Do not launch the client from a configuration (.axc) file.
- Do not launch the client using "Run As" functionality.
- Keeping the client open, navigate back to the AX client form where you want to start the trace collection.
- Start the client trace from the client configuration utility--this should trigger both the client and server traces to start tracing. Only the session activity for the client you have open will be traced.
- Verify that the client and server traces are running by typing the following from a command prompt: logman -ets query (This is for Windows Server 2008) or logman -ets query providers (This is for Windows Server 2003). This will show a list of active traces. Make sure the AX client and server traces are running. If the traces don't show up in the list, you'll have to investigate the problem. Check the troubleshooting section for common issues.
- Perform the task you wish to trace in the Dynamics AX client.
- Stop the trace from the client configuration utility.
- Verify that the client and server traces are stopped by typing the following from a command prompt: logman -ets query (This is for Windows Server 2008) or logman -ets query providers (This is for Windows Server 2003).
- Two trace files (one with client activity and one with server activity) should have been generated. The files are located in the client and server log folders.
- Refer to the General tab on the client configuration utility for the client log location.
- Refer to the Tracing tab on the server configuration utility for the server log location.
Now you're ready to supply these trace files to a support engineer or load them into a tool such as Trace Parser to view the results.
Troubleshooting Trace Collection Issues
Security is the most common issue that prevents tracing from starting successfully. Below are some things to consider when troubleshooting security issues:
- Check the application event log for errors. Error code 5 indicates an access denied issue.
- The account running the AOS instance must belong to the 'Performance Log Users' local group on the AOS if it is running on Windows Server 2003 or 2008. The WMI event tracing subsystem requires that tracing can be started only from a user belonging to this local group or to the local Administrators group.
- The client trace is initiated by the currently logged on user, so verify that that user has access to the log path defined in the client configuration utility. You can adjust the location of the log in the client configuration utility if necessary for testing.
- The server trace is initiated by the account running the AOS instance, so verify that that user has access to the log path defined in the server configuration utility. The log path cannot be changed in the server configuration utility, but it can be changed directly in the registry if necessary. Here is the registry path where the log directory is defined for a Dynamics AX 2009 instance using the Original installed configuration: HKEY_CURRENT_USER\Software\Microsoft\Dynamics\5.0\Configuration\Original (installed configuration)\logdir
- User Account Control (UAC) has prevented traces from starting from time to time. When opening the client utility, try right-clicking and selecting "Run as Administrator." If that doesn't help, try tracing with UAC disabled on the server.
- In some cases when launching the AX client from Windows Server 2008, you may need right-click and select "Run as Administrator" in order for the trace collection to start just like you did when opening the AX client utility.
- Check to make sure you have enough drive space to satisfy the value you entered in the registry for tracemaxfilesize. If you specify 10GB for that value, you'll actually need 12GB of free space available because an additional 20% is necessary for trace overhead. Adjust the setting down if disk free space is an issue.
- If the Dynamics AX client has been installed, but never launched, or only launched via axc files, the client registry settings will not exist. The Dynamics key under HKCU\Software\Microsoft gets created the first time the currently logged on user launches the AX client application from the start menu. Tracing will not start if the registry settings don't exist.
Part 3 of this series can be found here.