How is the logger level set?

I just went in and changed all my “log” xml action statements to ‘<log level=“debug” …’ in my service xml files. How do I set the logger level to ‘debug’ when I want to see them. I’ve tried changing log4j2.xml files, but I don’t know which one to change and which line.

1 Like

This is a good question

Note this isn’t tested on my side, but should work.

To enable debug logging for your XML actions, you need to modify two things:

  1. Change the property value for moqui.logger.level.xml_action from “info” to “debug”:
<Property name="moqui.logger.level.xml_action">debug</Property>
  1. You might also want to set the root logger level to debug to ensure all debug messages get through:
<Root level="debug"><AppenderRef ref="AsyncLog"/></Root>

There are three ways you can apply these changes:

  1. Edit the log4j2.xml file directly as shown above
  2. Set system properties when starting your application:
    -Dmoqui.logger.level.xml_action=debug
    
  3. Set environment variables:
    export moqui_logger_level_xml_action=debug
    

The system property or environment variable approach is often preferred as it doesn’t require modifying the configuration file and can be changed without redeploying.

After making these changes, you’ll need to restart your application for the new logging configuration to take effect. The debug logs should then appear in your log file at moqui_logs/log/moqui.log (or whatever path is configured for your environment).