Session.SendTraceTag(Text, Text, Verbosity, Text [, DataClassification]) Method

Version: Available or changed with runtime version 1.0 until version 6.0 where it was deprecated for the following reason: "Use LogMessage instead."

Send a trace tag to the telemetry service.

Note

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

Syntax

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

Note

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

Parameters

Tag
 Type: Text
The tag.

Category
 Type: Text
The category.

Verbosity
 Type: Verbosity
The verbosity.

Message
 Type: Text
The message.

[Optional] 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
Get Started with AL
Developing Extensions