Session.LogMessage(Text, Text, Verbosity, DataClassification, TelemetryScope, Text, Text [, Text] [, Text]) Method
Version: Available or changed with runtime version 5.4.
Logs a trace message to a telemetry account.
Syntax
Session.LogMessage(EventId: Text, Message: Text, Verbosity: Verbosity, DataClassification: DataClassification, TelemetryScope: TelemetryScope, Dimension1: Text, Value1: Text [, Dimension2: Text] [, Value2: Text])
Note
This method can be invoked without specifying the data type name.
Parameters
EventId
Type: Text
The eventId custom dimension of the trace message. Note that the Business Central platform will prefix this with "al" when emitting data to telemetry.
Message
Type: Text
The message logged into telemetry.
Verbosity
Type: Verbosity
The verbosity of the log.
DataClassification
Type: DataClassification
Classification of data in message.
TelemetryScope
Type: TelemetryScope
Specifies the scope of this trace message:
- ExtensionPublisher: Will emit this trace message to the Extension Publisher's telemetry account.
- All: Will emit this trace message additionally to the Partner's telemetry account.
Dimension1
Type: Text
Additional dimension that will be emitted to the telemetry account and that can be used to specify filters in the query.
Value1
Type: Text
The value of Dimension1.
[Optional] Dimension2
Type: Text
Additional dimension that will be emitted to the telemetry account and that can be used to specify filters in the query.
[Optional] Value2
Type: Text
The value of Dimension2.
Remarks
For more information about using this method, see Creating Custom Telemetry Events for Application Insights.
Example
trigger OnRun();
begin
LogMessage('MyExt-0001', 'This is a critical error message', Verbosity::Critical, DataClassification::CustomerContent, TelemetryScope::ExtensionPublisher, 'result', 'failed', 'reason', 'critical error in code');
end;