title | category | space |
---|---|---|
Log Levels |
Monitoring & Troubleshooting |
Mendix 5 How-to's |
Each application has a log and log-messages to monitor the health of the running of the application. Log levels are used to distinguish the log messages and to highlight the highest priority ones so that they can receive the immediate intervention they require. This How-To will therefore teach you how to configure the log levels for the various occurrence of logging within your application. You will start with the basics around logging and its uses. Moving onto the practices around configuring the log levels.
Log messages are a note that appears in the log of your Mendix application filled with an abundance of contextual information, such as:
- The date/time created
- The level
- The node
- A detailed message
- A stack trace
Log Node
The log node name defines the source of the log message, for instance a log message from the email module, the log name would appear as “Email Module”.
The message
Most messages in the log are auto-generated by the system for instance ‘Mendix Runtime successfully started, the application is now available’. However for logging that have been created via microflow, log messages can be customized by the developer.
Customized log messages are created by defining a template, in the example above the template for the message is:
‘Email not sent to customer {1}’
The template is the structure of the log’s message, and can be composed of parameters and free text. If we take the example above, when the error occurs we insert into the parameter placeholder ‘{1}’ the customer’s full name. Therefore producing the log message ‘Email not sent to customer John Smith’. This log message is now customized to data specific to the situation.
The stack trace
The stack trace is a list of method calls from the point when the application was started to the point where the exception was thrown. In the modeler, log messages that include a stack trace are marked with a paperclip icon () and double-clicking them shows the stack trace.
The log level defines the severity of the log message. In the modeler, this is represented by different colors and an icon. Current log levels used by Mendix are:
Within this part of the how to you will learn how to configure the log levels of the logging messages produced by the system. The different levels highlighted above in section 1.2, can be applied to custom logging and to the predefined logging produced by the Mendix Business Modeller. This section will define how to configure both the log levels in custom logging and the predefined logging created by the Modeller.
- Open the console
- Click ‘Advanced’ to open the drop down list of advanced options
- On the list of options click ‘Set log levels…’
You can now select the level that which a log node will log messages as.
- Set the relevant log node
- Click on the drop down list, in the log level column
- From the drop down list select the correct level
You can also set the level of log messages in ones that you have created via a microflow.
- Open the relevant microflow, for which you intend to change its log message’s level.
- Double click on the ‘log message activity’
- From the drop list, in the log level row select the correct level