Because of the modular aspect of AX for Retail, it can sometimes be a bit daunting to try and track down the log files when troubleshooting. Here is a recap of where to go looking.
Log messages for Retail POS are stored in the POSISLOG table in the POS database. The logging level is configured in the Headquarters (Dynamics AX client) in the Functionality Profile window: Retail Headquarters > Setup > POS > Functionality Profiles > Functions tab.
Keep in mind that a Functionality Profile is assigned at the store level. For day-to-day processing, you will likely use “Error” level. When debugging a particular issue, you can safely move this up to “Trace” which is where we will have you set it if we’re helping debug an issue. Remember to push down any changes with an N- or A- job.
To view the log, use your favorite SQL editor (probably SQL Server Management Studio) and execute this query against the POS database:
select top 1000 * from POSISLog order by ID desc
A couple of additional notes:
- In the POSISLOG table, you will see durations on some operations. These can sometimes be misleading as they may be cumulative timings or include time waiting for the user to perform a task in the user interface. Because the POS is a Microsoft .Net Windows application, there are other code profiling tools that can be used to analyze performance issues.
- If there are issues with the initial configuration of the POS, the SQL database may not be available yet. In this case, messages are logged to the current user’s AppData folder. In Windows 7 this would normally be here: C:\Users\[user]\AppData\Local\Microsoft Dynamics AX\50\Retail POS\Logs
Retail Transaction Service
Retail Transaction Service can be a little tricky to debug.
First, since all Retail Transaction Service calls originate in the POS, you should start by looking at the POSISLOG table for messages. Additionally, because Retail Transaction Service uses the .Net Business Connector to call business logic in AX, you should also look use the Windows Event Viewer to view the Application Log on the Retail Transaction Service machine. X++ exceptions can usually be viewed there.
To set up logging on the service itself, you need to modify the Retail Transaction Service configuration file. Launch your favorite text editor in Admin mode and open RetailTransactionService.exe.config. On a 64-bit machine, this is located in C:\Program Files (x86)\Microsoft Dynamics AX\50\Retail Transaction Service by default.
Change the following line to the appropriate logging level (0 = None, 1 = Error, 2 = Debug, 3 = Trace). You will need to restart the service for it to take effect.
<add key=”LogLevel” value=”3″ />
Retail Store Connect is not very chatty in its logging, so when troubleshooting, set this to Trace (3).
You cannot change the location of the resulting log file which will be located in the AppData folder for the service login. This user is defined in the in Control Panel > Administrative Tools > Services > Microsoft Dynamics AX for Retail Transaction Service. By default, the log file will be C:\Users\[user]\AppData\Local\Microsoft Dynamics AX\50\Retail Transaction Service\Logs\Retail Transaction Service.log.
Retail Store Connect
Retail Store Connect is more straightforward to set up. Launch the Retail Store Connect Settings application and select service instance. Hitting “next” four times will bring you to the Server Debugging Properties form. Here you can set the Log Level by marking one or more of the checkboxes (Error, Main, Actions, Detail, Functions). We will usually have you set the level to 15 (all except Functions). Logging at the Functions level will flood the log file and isn’t very helpful.
A couple of notes:
- Make sure you mark the Log Mode checkbox. This is the “master switch” for logging – if you do not have this marked, you will not get any logging at all.
- You can write log messages to the Windows Event Log, but this is not a very efficient way to view the messages, so don’t bother with this.
- By default, the log files are stored to the %s\Microsoft Dynamics AX\50\Retail Store Connect\[INSTANCE]\logs folder. %s is not a Windows standard – in Retail Store Connect it resolves to the service user’s Appdata folder. Since I have my service running as my own domain account, this is the directory for this instance:
- C:\Users\serstad\AppData\Local\Microsoft Dynamics AX\50\Retail Store Connect\ST9CONNECT\logs
- The log files are automatically recycled based on the number you enter in the “Max Lines / Logile” field. There are six files: 1.log, 2.log, 3.log, 1.old, 2.old, and 3.old. All six files are relevant and it is pretty random to determine which one is the “current” file.
- It can sometimes be useful to see the contents of the package files that are being sent through Retail Store Connect. By marking the “Keep Package Files” checkbox, those XML files will be stored in the “work” directory as defined in the “Working Directory” field (two screens previous). It is recommended to only do this for a limited period of time, as they can fill up a hard drive if left on permanently.
Aside from the logging built in to Retail Store Connect, there are a couple other ways to monitor your service instances.
The Messaging database for Retail Store Connect usually gives a quick glance at the health of a particular instance. Here are two queries that I like to use:
select Servermsg, Status, * from outgoingmessages order by packageno desc
select RemotePkg, Servermsg, * from incomingmessages order by packageno desc
For long-term monitoring of your entire Retail Store Connect infrastructure, error messages for all instances can be viewed in the Headquarters by using the Retail Store Connect Messages window:
Refer to the ‘”Retail Store Connect Status” section of the Headquarters User’s Guide for information on configuring this feature.
Retail Store Connect Client Controls
If you look closely at the Retail Store Connect Settings window, you will notice that clicking on the “Client Controls” button brings up a form with more logging options:
The fields on this window are very similar to the general Retail Store Connect logging options. These settings are used to log messages when the Dynamics AX client (the scheduler) communicates with Retail Store Connect through the client controls. By default, these messages are logged to the same directory (and same files) as the general Retail Store Connect log messages, but you can override this location with the “Log Dir:” field.
Do you have any other tips for troubleshooting AX for Retail? Did I miss any in this article? If so, feel free to comment below.