{"title":"Session.LogMessage(Text, Text, Verbosity, DataClassification, TelemetryScope, Text, Text [, Text] [, Text]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-string-string-string-string-method/","by":"JOP-AL","license":"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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"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","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Logs a trace message to a telemetry account.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Session.LogMessage(Text, Text, Verbosity, DataClassification, TelemetryScope, Text, Text [, Text] [, Text]) Method","slug":"sessionlogmessagetext-text-verbosity-dataclassification-telemetryscope-text-text-text-text-method","at":0,"chars":2316},{"level":2,"title":"Syntax","slug":"syntax","at":222,"chars":309},{"level":2,"title":"Parameters","slug":"parameters","at":531,"chars":1201},{"level":2,"title":"Remarks","slug":"remarks","at":1732,"chars":184},{"level":2,"title":"Example","slug":"example","at":1916,"chars":265},{"level":2,"title":"Related information","slug":"related-information","at":2181,"chars":135}],"text":"# Session.LogMessage(Text, Text, Verbosity, DataClassification, TelemetryScope, Text, Text [, Text] [, Text]) Method\n> Version: _Available or changed with runtime version 5.4._\nLogs a trace message to a telemetry account.\n## Syntax\n```al\n Session.LogMessage(EventId: Text, Message: Text, Verbosity: Verbosity, DataClassification: DataClassification, TelemetryScope: TelemetryScope, Dimension1: Text, Value1: Text [, Dimension2: Text] [, Value2: Text])\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nEventId\nType: ../text/text-data-type\nThe eventId custom dimension of the trace message. Note that the Business Central platform will prefix this with \"al\" when emitting data to telemetry.\nMessage\nType: ../text/text-data-type\nThe message logged into telemetry.\nVerbosity\nType: ../verbosity/verbosity-option\nThe verbosity of the log.\nDataClassification\nType: DataClassification<../../../developer>\nClassification of data in message.\nTelemetryScope\nType: ../telemetryscope/telemetryscope-option\nSpecifies the scope of this trace message:\n ExtensionPublisher: Will emit this trace message to the Extension Publisher's telemetry account.\n All: Will emit this trace message additionally to the Partner's telemetry account.\nDimension1\nType: ../text/text-data-type\nAdditional dimension that will be emitted to the telemetry account and that can be used to specify filters in the query.\nValue1\nType: ../text/text-data-type\nThe value of Dimension1.\n*[Optional] Dimension2*\nType: ../text/text-data-type\nAdditional dimension that will be emitted to the telemetry account and that can be used to specify filters in the query.\n*[Optional] Value2*\nType: ../text/text-data-type\nThe value of Dimension2.\n## Remarks\nFor more information about using this method, see Creating Custom Telemetry Events for Application Insights<../../devenv-instrument-application-for-telemetry-app-insights>.\n## Example\n```al\ntrigger OnRun();\nbegin\n    LogMessage('MyExt-0001', 'This is a critical error message', Verbosity::Critical, DataClassification::CustomerContent, TelemetryScope::ExtensionPublisher, 'result', 'failed', 'reason', 'critical error in code');\nend;\n```\n## Related information\nsession-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}