Bearbeiten

Freigeben über


Session.LogMessage(Text, Text, Verbosity, DataClassification, TelemetryScope, Dictionary of [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, CustomDimensions: Dictionary of [Text, Text])

Note

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

Parameters

EventId
 Type: Text
The event ID of trace message.

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.

CustomDimensions
 Type: Dictionary of [Text, Text]
Set of additional dimensions, specified as a dictionary, that will be emitted to the telemetry account and that can be used to specify filters in the query.

Remarks

For more information about using this method, see Creating Custom Telemetry Events for Application Insights.

Example

trigger OnRun();
var
    CustomDimensions: Dictionary of [Text, Text];
begin
    CustomDimensions.Add('result', 'failed');
    CustomDimensions.Add('reason', 'critical error in code');
    CustomDimensions.Add('alCallstack', "Error Message Management".GetCurrCallStack());    
    LogMessage('MyExt-0001', 'This is a critical error message', Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, CustomDimensions);
end;

Session Data Type
Get Started with AL
Developing Extensions