Loading

How to Enable Debug Logging for Log4j2

Data pubblicazione: Jul 25, 2025
Operazione

Enable Debug logging for Log4j2 to review which configuration file is picked up and applied

Fasi

Set the Java system property below to enable debug logging for log4j2:

-Dlog4j2.debug=true

For detailed instructions, refer to the knowledge article "How to Set Mule and Java System Properties at Startup in Various Environments":

https://help.salesforce.com/s/articleView?id=001115098&type=1

Risorse aggiuntive

The following are sample logs extracted from the mule_ee.log file for Mule Runtime On-Premises

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+ Initializing app 'httptest'                                                  +

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

INFO StatusLogger Found logging config for application 'domain/default/app/httptest' at 'file:/Users/adam/mule-enterprise-standalone/apps/httptest/log4j2.xml'

 

DEBUG StatusLogger Reconfiguration started for context[name=domain/default/app/httptest] at URI file:/Users/adam/mule-enterprise-standalone/apps/httptest/log4j2.xml (org.mule.runtime.module.log4j.internal.MuleLoggerContext@4636f003) with optional ClassLoader: null

 

DEBUG StatusLogger null null initializing configuration XmlConfiguration[location=/Users/adam/mule-enterprise-standalone/apps/httptest/log4j2.xml]

 

  • Logs corresponding to the PatternLayout configuration in log4j2.xml file:
    <PatternLayout pattern=
    "%-5p %d [%t] [processor: %X{processorPath}; event: %X{correlationId}] %c: %m%n"/>:

DEBUG StatusLogger Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].

DEBUG StatusLogger PatternLayout$Builder(pattern="%-5p %d [%t] [processor: %X{processorPath}; event: %X{correlationId}] %c: %m%n", PatternSelector=null, Configuration(/Users/adam/mule-enterprise-standalone/apps/httptest/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")

 

  • Logs corresponding to the SizeBasedTriggeringPolicy configuration in log4j2.xml file:
    <SizeBasedTriggeringPolicy size=
    "10 MB"/>:

 

DEBUG StatusLogger createPolicy(size="10 MB")

  • Logs corresponding to the DefaultRolloverStrategy configuration in log4j2.xml file:
    <DefaultRolloverStrategy max=
    "10"/>:

DEBUG StatusLogger DefaultRolloverStrategy$Builder(max="10", min="null", fileIndex="null", compressionLevel="null", ={}, stopCustomActionsOnError="null", tempCompressedFilePattern="null", Configuration(/Users/adam/mule-enterprise-standalone/apps/httptest/log4j2.xml))

 

DEBUG StatusLogger RollingFileAppender$Builder(fileName="/Users/adam/mule-enterprise-standalone/logs/httptest.log", filePattern="/Users/adam/mule-enterprise-standalone/logs/httptest-%i.log", append="null", locking="null", SizeBasedTriggeringPolicy(SizeBasedTriggeringPolicy(size=10485760)), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=10, useMax=true)), advertise="null", advertiseUri="null", createOnDemand="null", filePermissions="null", fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%-5p %d [%t] [processor: %X{processorPath}; event: %X{correlationId}] %c: %m%n), name="file", Configuration(/Users/adam/mule-enterprise-standalone/apps/httptest/log4j2.xml), Filter=null, ={})

 

TRACE StatusLogger New file '/Users/adam/mule-enterprise-standalone/logs/httptest.log' created = false

DEBUG StatusLogger Returning file creation time for /Users/adam/mule-enterprise-standalone/logs/httptest.log

DEBUG StatusLogger Starting RollingFileManager /Users/adam/mule-enterprise-standalone/logs/httptest.log

 

  • Logs corresponding to the AsyncLogger configurations in log4j2.xml file:

        <AsyncLogger name="org.mule.runtime.core.internal.processor.LoggerMessageProcessor" level="INFO"/>

DEBUG StatusLogger AsyncLoggerConfig$Builder(additivity="null", level="INFO", levelAndRefs="null", name="org.mule.runtime.core.internal.processor.LoggerMessageProcessor", includeLocation="null", ={}, ={}, Configuration(/Users/adam/mule-enterprise-standalone/apps/httptest/log4j2.xml), Filter=null

Numero articolo Knowledge

005104889

 
Caricamento
Salesforce Help | Article