Partager via


Microsoft Dynamics NAV Server Trace Events

This article provides an overview of the trace events that are generated by Dynamics NAV server instance.

Overview

  • There are two event trace providers that publish different trace events to the event log: Microsoft-DynamicsNAV-Server and Microsoft-DynamicsNAV-Common. The Microsoft-DynamicsNAV-Common provider is strictly for telemetry trace events. All other events use Microsoft-DynamicsNAV-Server. You typically need to specify the event trace provider in the monitoring tool that you are using.

  • There are several types of trace events for each event trace provider, including: Windows event viewer, SQL traces, service calls, C/AL function calls, and telemetry. Trace event types are identified by a keyword with a corresponding decimal and hexadecimal value. The keywords and values enable you to collect data on specific trace events. Some tools support the hexadecimal values only and other tools support both hexadecimal and decimal.

  • For some trace events, there is separate event for when an operation starts and when it stops. This enables you to determine the duration of the operation. Some monitoring tools, such as PerfView, will automatically return the duration in the stop event.

  • Some monitoring tools might interpret and display the collected event trace differently than others. For more information, see Event Trace Data.

Windows Event Viewer Trace Events

Windows Event Viewer trace events track errors, warnings, and information messages that provide information about the condition or state of Microsoft Dynamics NAV Server instances. These events can be viewed in the DynamicsNAV channel logs and Application log of Event Viewer on the computer that is running Microsoft Dynamics NAV Server. For more information, see Monitoring Dynamics NAV Server Events Using Event Viewer.

Event trace provider Keyword Decimal value Hexadecimal value
Microsoft-DynamicsNAV-Server EventViewer 1 0x1

For a list and description of EventViewer trace events, see Microsoft Dynamics NAV Server Admin and Operational Events.

SQL Trace Events

SQL trace events track a specific set of SQL statements that are executed from the Microsoft Dynamics NAV Server instance against the Dynamics NAV database on SQL Server.

Event trace provider Keyword Decimal value Hexadecimal value
Microsoft-DynamicsNAV-Server SQLTracing 2 0x2

The event data that is collected includes: session ID, tenant ID, the Dynamics NAV user, and the SQL statement. For more information, see Event Trace Data.

The following table lists the SQL trace events.

ID Event (task/opcode) What is traced
1 ExecuteScalar/Start SQL statements that query a database table and return a single field from a row in the query result.
2 ExecuteScalar/Stop SQL statements that query a database table and return a single field from a row in the query result.
3 ExecuteNonQuery/Start SQL statements that return a number of rows from a database table
4 ExecuteNonQuery/Stop SQL statements that return a number of rows from a database table
5 ExecuteReader/Start SQL statements that return a set of rows from a database table.
6 ExecuteReader/Stop SQL statements that return a set of rows from a database table.
7 ReadNextResult/Start SQL statements that return the next result from a database query.
8 ReadNextResult/Stop SQL statements that return the next result from a database query.
9 ReadNextRow/Start SQL statements that return the next row in database table.
10 ReadNextRow/Stop SQL statements that return the next row in database table.
11 BeginTransaction/Start SQL statements that start a database transaction.
12 BeginTransaction/Stop SQL statements that start a database transaction.
13 Prepare/Start SQL statements that create a prepared version of the command on an instance of SQL Server.
14 Prepare/Stop SQL statements that create a prepared version of the command on an instance of SQL Server.
15 OpenConnection/Start SQL statements that open connection to the database from the connection pool.
16 OpenConnection/Stop SQL statements that open connection to the database from the connection pool.
17 Commit/Start SQL statements that commit a database transaction.
18 Commit/Stop SQL statements that commit a database transaction.
19 Rollback/Start SQL statements that cancel the changes in a pending database transaction.
20 Rollback/Stop SQL statements that cancel the changes in a pending database transaction.

Service Call Trace Events

Service call trace events track when Dynamics NAV clients run the Dynamics NAV objects: Queries, Reports, and XMLports.

Event trace provider Keyword Decimal value Hexadecimal value
Microsoft-DynamicsNAV-Server ServiceCall 4 0x4

The event data that is collected includes: session ID, tenant ID, Dynamics NAV user, and the Dynamics NAV object ID. For more information, see Event Trace Data.

The following table lists the service call trace events.

ID Event (task/opcode) What is traced
300 RunQuery/Start Dynamics NAV Query objects that are opened and closed.
301 RunQuery/Stop Dynamics NAV Query objects that are opened and closed.
302 RunReport/Start Dynamics NAV Report objects that are opened and closed.
303 RunReport/Stop Dynamics NAV Report objects that are opened and closed.
310 RunXmlPort/Start Dynamics NAV XMLport objects that are opened and closed.
311 RunXmlPort/Stop Dynamics NAV XMLport objects that are opened and closed.
500 OpenSession Microsoft Dynamics NAV Windows clients and Microsoft Dynamics NAV Web clients establish a connection to the Microsoft Dynamics NAV Server instance.
501 CloseSession Microsoft Dynamics NAV Windows clients and Microsoft Dynamics NAV Web clients establish a connection to the Microsoft Dynamics NAV Server instance.

C/AL Function Trace Events

C/AL function tracing events track the execution of C/AL functions and statements on the Microsoft Dynamics NAV Server instance.

Event trace provider Keyword Decimal value Hexadecimal value
Microsoft-DynamicsNAV-Server ALTracing 8 0x8

The event data that is collected includes: session ID, tenant ID, Dynamics NAV user, C/ALC/AL function, C/AL statements, and line number. For more information, see Event Trace Data.

Important

If the Microsoft Dynamics NAV Server instance is not configured for full C/AL function tracing, then only root-level C/AL function will be traced. Statements and C/AL functions that are called from functions will not be traced. By default, the Microsoft Dynamics NAV Server instance is not configured for full C/AL functionf tracing. For information about how to specify full C/AL function tracing, see Configuring Microsoft Dynamics NAV Server.

The following table lists the C/AL function tracing events.

ID Event (task/opcode) What is traced
400 ExecuteALFunction/Start C/AL functions that are called.
402 ExecuteALFunctionFailed Errors that occur when executing C/AL functions. The errors can be caused by exceptions or ERROR Function (Dialog) calls.
403 ExecuteALFunction C/AL statements that are executed.

Important: This trace event is only traced when the Microsoft Dynamics NAV Server is configured to full C/AL function tracing.

Telemetry Trace Events

Telemetry trace events can provide data about operations in the application and how it is being used in production. These events include both system telemetry trace events and user-defined, custom telemetry trace events.

Event trace provider Keyword Decimal value Hexadecimal value
Microsoft-DynamicsNAV-Common TelemetryTracing 32 0x20

Custom telemetry trace events are emitted from the application. These are events that are sent by SENDTRACETAG function calls from inside the application. For more information about custom telemetry trace events, see Instrumenting an Application for Telemetry.

Some of the important event data that is collected for both system and custom telemetry trace events includes: tag, category, message, dataclassification. For more information about this data, see Event Trace Data.

Telemetry events can have one of the following event IDs, based on the data classification and verbosity (severity level):

Data classification Verbosity ID
All except CustomerContent and EndUserIdentifiableInformation Critical 700
Error 701
Informational 702
Informational 703
Verbose 704
Warning 705
Informational 706
CustomerContent or EndUserIdentifiableInformation Critical 707
Error 708
Informational 709
Informational 710
Verbose 711
Warning 712

Note

Event IDs 703, 706, and 710 are used only for system telemetry trace events. All other IDs are used for both system and custom events.

Event Trace Data

The following table lists the arguments that make up the data collected for trace events. When viewing event trace data, the way that the arguments are interpreted and displayed can vary depending on the tool that you use.

Argument Description Trace event type
category Specifies the category of the telemetry trace event. Telemetry (TelemetryData)
connectionType Specifies the RoleTailored client that has established the connection to the Dynamics NAV server instance. Values include Microsoft Dynamics NAV Windows client and Microsoft Dynamics NAV Web client. Service calls (ServiceCall)
dataclassification Specifies the client that has established the connection to the Dynamics NAV server instance. Values include Microsoft Dynamics NAV Windows client and Microsoft Dynamics NAV Web client. Service calls (ServiceCall)
failureMessage Includes the error message that is returned when a C/AL function fails. C/AL function trace events (ALTracing)
functionName Specifies the C/AL function that was executed. C/AL function trace events (ALTracing)
lineNumber Specifies the line number of the statement in the C/AL code of the Dynamics NAV object that was executed. C/AL function trace events
message Specifies the error, warning, or information message text that was issued for a trace event Windows event log trace events (EventViewer)

Telemetry (TelemetryData)
objectId Specifies the ID of the Dynamics NAV object that was executed in the session. Service calls trace events (ServiceCall)

C/AL function trace events (ALTracing)
objectType Specifies the Dynamics NAV object type that executed by a C/AL function or statement. Values include the following: CodeUnit, Page, Query, Report, Table, and XMLport. C/AL function trace events (ALTracing)
sessionId Specifies the ID that is assigned to the session that is used by the operation. Each operation establishes a session with the Microsoft Dynamics NAV Server instance from a connection in the Microsoft Dynamics NAV Server's connection pool. All
sqlStatement Specifies the SQL statement that was executed on the session. SQL trace events (SQLTracing)
statement Specifies the C/AL statement that was executed on the session. C/AL function trace events
tenantId Specifies the ID of the tenant database that is mounted on the Microsoft Dynamics NAV Server instance. If the Microsoft Dynamics NAV Server instance is not configured for multitenancy, then the value is empty. For more information about multinenancy, see Multitenant Deployment Architecture. All
userName Specifies the Dynamics NAV user account that is logged on to the session. All

See Also

Monitoring Microsoft Dynamics NAV Server Events
Classifying Data