Business Central Server Trace Events

This article provides an overview of the trace events that are generated by Business Central 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, 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 Business Central Server instances. These events can be viewed in the DynamicsNAV channel logs and Application log of Event Viewer on the computer that is running Business Central Server. For more information, see Monitoring Business Central 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 Business Central Server Admin and Operational Events.

SQL Trace Events

SQL trace events track a specific set of SQL statements that are executed from the Business Central Server instance against the Business Central 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 Business Central 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 Business Central clients run the Business Central 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, Business Central user, and the Business Central 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 Business Central Query objects that are opened and closed.
301 RunQuery/Stop Business Central Query objects that are opened and closed.
302 RunReport/Start Business Central Report objects that are opened and closed.
303 RunReport/Stop Business Central Report objects that are opened and closed.
310 RunXmlPort/Start Business Central XMLport objects that are opened and closed.
311 RunXmlPort/Stop Business Central XMLport objects that are opened and closed.
500 OpenSession Dynamics NAV Client connected to Business Centrals and Business Central Web clients establish a connection to the Business Central Server instance.
501 CloseSession Dynamics NAV Client connected to Business Centrals and Business Central Web clients establish a connection to the Business Central Server instance.

AL Methods Trace Events

AL function tracing events track the execution of AL functions and statements on the Business Central 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, Business Central user, AL function, AL statements, and line number. For more information, see Event Trace Data.

Important

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

The following table lists the AL function tracing events.

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

Important: This trace event is only traced when the Business Central Server is configured to full 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 method 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 (or seveity 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 Business Central server instance. Values include Dynamics NAV Client connected to Business Central and Business Central Web client. Service calls (ServiceCall)
dataclassification Specifies the RoleTailored client that has established the connection to the Business Central server instance. Values include Dynamics NAV Client connected to Business Central and Business Central Web client. Service calls (ServiceCall)
failureMessage Includes the error message that is returned when a AL function fails. AL function trace events (ALTracing)
functionName Specifies the AL function that was executed. AL function trace events (ALTracing)
lineNumber Specifies the line number of the statement in the AL code of the Business Central object that was executed. 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 Business Central object that was executed in the session. Service calls trace events (ServiceCall)

AL function trace events (ALTracing)
objectType Specifies the Business Central object type that executed by a AL function or statement. Values include the following: CodeUnit, Page, Query, Report, Table, and XMLport. 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 Business Central Server instance from a connection in the Business Central Server's connection pool. All
sqlStatement Specifies the SQL statement that was executed on the session. SQL trace events (SQLTracing)
statement Specifies the AL statement that was executed on the session. AL function trace events
tag Specifies the ID of the telemetry trace event. For system telemetry trace events, this ID is autogenerated. For custom telemetry trace events, it is user-defined. Telemetry (TelemetryData)
tenantId Specifies the ID of the tenant database that is mounted on the Business Central Server instance. If the Business Central 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 Business Central user account that is logged on to the session. All

See Also

Monitoring Business Central Server Events
Classifying Data