Client Access Log (Dynamics AX 2012)
Keeping track of multiple users’ activities as they do their work in the system is of great benefit when we run into problem areas where there is no information provided as to the cause of the crash. Having this type of tracing included would allow us to turn on tracing for all users or a subset of users over a long period of time to try and help narrow in on problem areas which can then be investigated in greater detail.
In Dynamics AX 2012, the administrator can choose to enable client access log at the user level and the user actions (like form open, close) will be recorded in a new table called SysClientAccessLog. The control field to enable or disable this feature is added to UserInfo table. This feature is compiled only for rich client and by default is turned off.
How to enable Client Access log?
There are two log levels that can be enabled in the UserInfo Table.
a) High Level. Value of 1
b) Detailed Level. Value of 2
The logging can be turned on per user.
update USERINFO set CLIENTACCESSLOGLEVEL = 1 where id = '<axuserid>'
update USERINFO set CLIENTACCESSLOGLEVEL = 2 where id = '<axuserid>'
After running the above SQL statement in AX database, the user (<axuserid>) will have to restart his/her AX Client for the logging to start.
What is logged for each level?
· Form open and close.
· Form part open and close.
At this level, we get an entry for each form/form part open and close.
· Esc pressed
· Print Preview
· Next Record
· Previous Record
· End record
· Select all
· Sort Ascend
· Sort Descend
In addition to form, event, time, computer name, the duration (elapsed time) is logged in milliseconds for each event.
How often is it flushed to database?
Every AX client that has logging enabled will hold the logs in memory until a threshold (not-configurable, stands at 60 now) is reached. After the threshold, the logs are flushed into AX database. One record is inserted into SysClientAccessLog for each flush. The flush also happens when the AX Client is closed.
How to view the user activity?
Each record in SysClientAccessLog contains Session ID, Client Computer, CreatedDateTime and an Events container. Events container is a container of containers of (form Name, Event Name, and duration in milliseconds, company and the timestamp when the event occurred).
Sample form to view user activity Download
Disclaimer: The project in the above xpo is provided "AS IS" with no warranties, and confers no rights.
Please import the xpo from the above link.
Open AOT and navigate to Forms\ClientAccessLogListPage and open the form.
First time you run the form, the grid would be empty. You need to click on “Check for More Logs” button in ClientAccessLog tab.
There are two more buttons:
a) Delete-ClientAccessLogFlat: This deletes all the rows from the expanded user table(ClientAccessLogFlat)
b) Delete-SysClientAccessLog: This button deletes all the rows from kernel table (SysClientAccessLog). When you do this action, you lose all the logs.
You will be able to sort/filter on any of the columns.
Sample view of the form:
(If the AosId shows up as blank, we couldn’t fetch the AosID based on the information in the SysClientAccessLog table.)
You can filter the grid based on start log time and end log time. Additionally you can filter by grid (Ctrl + G) or use advance filter (Ctrl + F3). Refer to AX 2012 help for filtering if needed.