Logging Module

Content Type: Module
Categories: Tracing

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

Logging Module

Description

This module stores your application's log messages as Mendix objects in the database, allowing you to view and search logs directly in the Mendix web client.

It runs alongside your normal logging options (like server file or console logging) and has its own independent log level setting. It also features a scheduled event to clean up old messages, and a powerful PreFilter Rule Engine to strictly control what gets saved to the database.

Typical Usage Scenarios

  • Giving application administrators access to logs directly from the Mendix interface.
  • Quickly searching logs for specific errors without downloading or parsing text files.
  • Filtering out noisy log messages (like specific node chatter or stack traces) before they ever reach the database to save space.

 

Features and Limitations

  • Independent Configuration: Choose which log levels to record (e.g., INFO and higher) independently from your server's base logging.
  • PreFilter Rule Engine: A flexible engine that evaluates incoming logs before they are saved. You can create rules to accept or drop messages based on regex matches against the log level, node, message text, or stack trace presence.
  • Log Management: Admins can manually delete log messages.
  • Automated Cleanup: The CleanupDataLogging scheduled event periodically removes old logs. Configure how many days to keep them using the LogHistoryDays constant.
  • Performance Note: Writing every log to the database can slow down your app. In a production environment, we highly recommend either logging only WARNING and higher, or heavily utilizing the PreFilter engine to drop unnecessary background noise.

PreFilter Rule Engine

The PreFilter intercepts every log message right before it gets saved. It runs the message through a prioritized list of rules to decide if it should be kept or thrown away.

How Evaluation Works (First-Match-Wins)

  • Rules are evaluated in order of their Priority number, from lowest (0) to highest.
  • The engine checks the rule's regex pattern against your chosen log field.
  • As soon as a rule matches, the engine applies the rule's Action (either keep or discard) and immediately stops evaluating the rest of the rules.
  • If a log message doesn't match any active rules, the system keeps it by default.

 

Creating Rules When setting up a rule, you will configure the following fields:

  • Action: Choose ACCEPT to keep the log or DROP to discard it.
  • Target: Select which part of the log the regex should check: LevelNodeMessage, or HasStackTrace.
  • Regex: Write a standard Java regular expression to match the text (uses partial match logic).
  • Priority: Use numbers (like 0, 1, 2) to sort the rules. Lower numbers run first.
  • IsActive: A toggle to easily turn rules on or off.

Note: If a rule is marked inactive, is missing a required field, or has invalid regex syntax, the engine safely skips it without breaking your logging.

Dependencies

  • Mendix 10.24 Environment
  • No further dependencies

Installation & Configuration

  1. Microflows: In your project settings, set your After Startup and Before Shutdown microflows to point to AfterStartup (in the Start folder) and BeforeShutdown (in the Stop folder) from the Logging module.
  2. UI: Place the Message_Overview_Content snippet somewhere in your app for users to view logs.
  3. Roles: Assign the Admin and/or ReadOnly module roles. Both can view logs, but only Admins can delete them.
  4. Base Log Level: Set the Logging.Level constant to the desired value (defaults to INFO).
  5. Automated Cleanup (Optional): Enable the Logging.CleanupDataLogging scheduled event and set the Logging.LogHistoryDays constant (defaults to -1, which means cleanup is disabled).
  6. PreFilter Rules (Optional): Open the PreFilter configuration page in your Mendix app to set up your rule list. Ensure every rule you create has a valid Action, Target, and Priority.

 

Releases

Version: 2.3.0
Framework Version: 10.24.0
Release Notes:

Changelog: PreFilter Rule Engine Upgrade (v2)

We've completely overhauled the PreFilter engine. Instead of just checking a simple regex against a log message, it's now a full rule engine that gives you much more control over what logs to keep or throw away.

 

What's New

  • Keep or Drop: You can now choose what happens when a rule matches. Use the new Action field to either ACCEPT (keep the log) or DROP (discard the log).
  • Target Specific Fields: Instead of only searching the main message text, you can now target specific parts of the log using the Target field. You can search against the LevelNodeMessage, or HasStackTrace.
  • Rule Priorities: You can now control the exact order in which rules run using the Priority number. The engine looks at rules starting from the lowest number (e.g., 0 is evaluated first).
  • First Match Wins: The engine stops evaluating as soon as it finds the first matching rule and applies that action.
  • Turn Rules On/Off: We added an IsActive toggle. This lets you disable rules temporarily without having to delete them entirely.
  • Better Error Handling: If you make a typo in your regex syntax, it won't break the whole system. The engine will just skip that broken rule and log a warning.

What You Need to Know (Breaking Changes & Migration)

  • Update Your Old Rules: All your existing rules in the database need to be updated with the new fields. If you leave these new fields empty, the engine will completely ignore the rules.
  • How to Keep the Old Behavior: To make your existing rules work exactly like they used to, set their Action to DROPTarget to MessagePriority to 0, and IsActive to true.
  • Default Behavior: If a log message doesn't match any of your active rules, it will be allowed through.
Version: 2.2.1
Framework Version: 10.24.0
Release Notes:
  1. Unpublish version 2.2.0; We found a bug on that version
  2. Update dependencies to latest version
  3. Set minimum version to 10.24.0
Version: 2.1.0
Framework Version: 10.18.0
Release Notes: - Update to Mx10.18 - Update to React client
Version: 2.0.1
Framework Version: 10.6.0
Release Notes: New Features: - Dynamic Prefilter: Implemented a dynamic prefilter to allow filtering out messages before they are saved to the database. Changes: - Scheduled Event Behavior: Updated the CleanupDataLogging scheduled event behavior. It now skips the next event in case of a schedule overlap, rather than delaying it. - Mx10 support: The module is now working for Mendix 10.
Version: 2.0.0
Framework Version: 9.24.0
Release Notes: New Features:
- Dynamic Prefilter: Implemented a dynamic prefilter to allow filtering out messages before they are saved to the database.

Changes:
- Scheduled Event Behavior: Updated the CleanupDataLogging scheduled event behavior. It now skips the next event in case of a schedule overlap, rather than delaying it.
Version: 1.10.0
Framework Version: 9.24.0
Release Notes: Update to Mx 9.24.0 Add filter to cleanup unwanted log messages
Version: 1.9.1
Framework Version: 8.18.0
Release Notes: - Upgrade to Studio Pro 8.18.0 - Small change to cleanup microflow
Version: 1.9.0
Framework Version: 8.12.5
Release Notes: Fix memory leak in java action