Logging Module
Overview
Module that stores all log messages of your application as Mendix objects in the database, enabling you to view and search the log in the Mendix web client. Can be used in addition to the normal logging options (logging to file or the Mendix console) and has its own independent log level setting.
Documentation
Description
Module that stores all log messages of your application as Mendix objects in the database, enabling you to view and search the log in the Mendix web client.
Can be used in addition to the normal logging options (logging to file or the Mendix console) and has its own independent log level setting.
Also contains a scheduled event for periodically cleaning up old log messages.
Typical usage scenario
- To provide administrators of your application access to the log from within the Mendix web client.
- If you want to be able to quickly search the log for any errors, without having to do a text search of the log file.
Features and limitations
- Which log levels should be logged (for example INFO and higher) is configurable and independent from other logging options (like logging to a file).
- Log messages can be deleted by an administrator.
- Contains a scheduled event (CleanupDataLogging) that can periodically cleanup old log messages; how long messages should be kept before deleting them is configurable using a constant (LogHistoryDays).
- Writing all log messages to the database can have a negative impact on the performance of your application, depending on the number of messages. In a production environment, it is recommended to log only messages of level WARNING and higher.
Installation
See the general instructions under How to Install.
Dependencies
- Mendix 9.24.0 Environment
- No further dependencies
Configuration
- Set the after startup and before shutdown microflows in your project settings: these should point to the microflows AfterStartup (in the folder Start) and BeforeShutdown (in the folder Stop) of the Logging module.
- Use the snippet Message_Overview_Content (in the User Interface folder of the Logging module) somewhere in your application.
- Assign the module roles Admin and/or ReadOnly of the Logging module to some of your user roles. Both roles can view the log, but Admin can also delete the log messages.
- Set the constant Logging.Level to the desired value: by default the value is INFO, for the other possible values see the documentation of this constant in the modeler.
- (optional) Enable the scheduled event Logging.CleanupDataLogging and configure the constant Logging.LogHistoryDays: by default the value is -1, which disables the cleanup of old log messages; for the other possible values see the documentation of this constant in the modeler.
Known bugs
- None
Frequently Asked Questions
Ask your question at the Mendix Community Forum
- None