Introduction
“App Logging” is a logging framework that enables to emit logging and debug information to multiple destinations. These logs can be categorized into categories and can be configured for each app and category and even user and where logs should be emitted.
Using this logger is really simple. You just have to follow these steps:
- Declare a variable for
codeunit 70623694 EOS004 App Logger - Initialize the codeunit using either
InitializeorInitializeForCaller - Emit log messages using the
LogMessagemethods. They are very similar to the ones used bySession.LogMessageand therefore shouldn’t give you much trouble.
Note
It is not guaranteed that calling one of theLogMessage overloades instantly send the log message to the destination. Log messages may be buffered internally (for performance reasons) and get sent to the destination only when calling Flush. This depends on the logger implementation (see below). You can configure such a flush to happen automatically after a certain number of messages using AutoFlushLimit. In any case, be sure to call Flush at the end of your procedure to ensure that any leftover messages are sent.You can find a more detailed example on https://github.com/EOS-Solutions/Sample/tree/master/EX004.EosAdminLib/Logging
The following log destinations are currently supported:
Application Insights (Default)
This is essentially the same as using Session.LogMessage. This will emit logs to the application insights account that is defined on the app and/or on the service. The benefit of using the App Logging framework instead of calling Session.LogMessage directly is that this is part of the “App Logging” framework, and thus these log messages are now configurable per user/app/category.
This logger does not buffer messages and thus does not require flushing.
Application Insights (Custom)
This is similar to Application Insights (Default), but allows to you to emit log messages to an arbitrary Application Insights account and is not limited to the ones defined in the app / service.
This logger buffers its messages and therefore requires flushing to send them.
Warning
This logger does not useSession.LogMessage and thus can not benefit from the asynchronous nature of that method. This means that any log message you emit will impact performance, also because there are HTTP calls to Application Insights will be made. Use with caution and use AutoFlushLimit to reduce the number of HTTP cals made.Internal
This is a logger that will log messages into a global temporary table that lives as long as the user session lives. You can use codeunit 70623696 EOS004 Internal Logger to access the logs that have been collected and export or persist them in whatever way you need.
This logger does not buffer messages and thus does not require flushing.
Setup
You can find the setup for “App Logging” on the page App Log Setup (EAL).

Here you can see a list of all currently active and configured loggers.
- App Name indicates the app fpr this logger configuration.
- Name specifies the category for this logger configuration.
- Username specifies the user for whom this logger configuration is active. This can be a single user or all users.
- Enabled specifies if theconfiguration is currently enabled
- Enabled From / Enabled to specifies the date/time range in which this logger will be enabled. If this is not specified, the logger is always active. In addition to this date/time range, the flag Enabled also needs to be active.
- Logger specifies the logger to which this configuration will write its log messages to.
- Service Config. Code specifies the service configration to use for the logger specified in Logger. This might not be necessary and it depends on the logger selected in Logger how and what should be selected here. At the moment, only Application Insights (Custom) requires a service configuration. Read more on this in Service configurations.
- Diagnostics Key is a randomly generated key that is sent along with any log messages that are written for this configuration. This helps you identify the configuration when analyzing your logs.
Using the New action, a new configuration can be created.

The following fields are required:
- App Id specifies the app for which to create a logger configuration. You will only see apps in this list that have subscribed to the event
OnCollectLogCategoriesand have provided at least one log category. Check the sample on GitHub for details on how to implement this. - App Name shows the name of the app you selected.
- Category lets you choose the log category for which you want to create the configuration. The values available are the value that the app provides through
OnCollectLogCategories. - Enabled For lets you choose if the configuration should be valid for all users, the currently logged in user or a specific user only.
- Username lets you choose the user for which you want to configure this log, if you have selected Specific User in Enabled For.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.