Session.SendTraceTag Method

Send a trace tag to the telemetry service.

Note

This method is supported only in Business Central on-premises.

Syntax

 Session.SendTraceTag(Tag: String, Category: String, Verbosity: Verbosity, Message: String [, DataClassification: DataClassification])

Note

This method can be invoked without specifying the data type name.

Parameters

Tag
 Type: String
The tag.

Category
 Type: String
The category.

Verbosity
 Type: Verbosity
The verbosity.

Message
 Type: String
The message.

DataClassification
 Type: DataClassification
Classification of data in message.

Remarks

You use the SENDTRACETAG method for instrumenting the application for telemetry. When the SENDTRACETAG method called, a telemetry trace event is emitted. The event can then be recorded in the Windows event log or collected by other event trace collection tools, like PerfView, Logman, and Performance Monitor.

A telemetry event is given one of the following event IDs, depending on the DATACLASSIFICATIONand VERBOSITY:

DATACLASSIFICATION VERBOSITY ID
All except CustomerContent and EndUserIdentifiableInformation Critical 700
Error 701
Informational 702
Verbose 704
Warning 705
CustomerContent or EndUserIdentifiableInformation Critical 707
Error 708
Informational 709
Verbose 711
Warning 712

Note

The SENDTRACETAG method is marked as obsolete in Business Central 2020 release wave 2 (v17). You can still use it, but we recommend that you send traces to Application Insights using the LOGMESSAGE method instead. For more information, see Creating Custom Telemetry Traces for Application Insights Monitoring.

Example

The following code defines simple telemetry events for the five different severity levels.

SENDTRACETAG('Cronus-0001', 'Action', VERBOSITY::Critical, 'This is a critical message.', DATACLASSIFICATION::CustomerContent);
SENDTRACETAG('Cronus-0002', 'Action', VERBOSITY::Error, 'This is an error message.',  DATACLASSIFICATION::EndUserIdentifiableInformation);
SENDTRACETAG('Cronus-0003', 'Action', VERBOSITY::Warning, 'This is a warning message.', DATACLASSIFICATION::AccountData);
SENDTRACETAG('Cronus-0004', 'Action', VERBOSITY::Normal, 'This is an informational message.', DATACLASSIFICATION::OrganizationIdentifiableInformation);
SENDTRACETAG('Cronus-0005', 'Action', VERBOSITY::Verbose, 'This is a verbose message.', DATACLASSIFICATION::SystemMetadata);

The events emitted by this code will have the events IDs (listed in the order that the are called): 707, 708, 705, 702, and 704.

See Also

Session Data Type
Getting Started with AL
Developing Extensions