# 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
```al
 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/text-data-type
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/text-data-type
The message logged into telemetry.
Verbosity
Type: ../verbosity/verbosity-option
The verbosity of the log.
DataClassification
Type: DataClassification<../../../developer>
Classification of data in message.
TelemetryScope
Type: ../telemetryscope/telemetryscope-option
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/text-data-type
Additional dimension that will be emitted to the telemetry account and that can be used to specify filters in the query.
Value1
Type: ../text/text-data-type
The value of Dimension1.
*[Optional] Dimension2*
Type: ../text/text-data-type
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/text-data-type
The value of Dimension2.
## Remarks
For more information about using this method, see Creating Custom Telemetry Events for Application Insights<../../devenv-instrument-application-for-telemetry-app-insights>.
## Example
```al
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;
```
## Related information
session-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-string-string-string-string-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-string-string-string-string-method/
