“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:
codeunit 70623694 EOS004 App Logger
Initialize
or InitializeForCaller
LogMessage
methods. They are very similar to the ones used by Session.LogMessage
and therefore shouldn’t give you much trouble.LogMessage
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.
Session.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.
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.
Using the New action, a new configuration can be created.
The following fields are required:
OnCollectLogCategories
and have provided at least one log category. Check the sample on GitHub for details on how to implement this.OnCollectLogCategories
.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.