Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleExample. Configuration file contents
log4j.rootLoggerlogger.aplLogger=ALL, a
log4j.appender.a=com.digitalroute.apl.log.DRRollingFileAppender
log4j.appender.a.file=${mz.home}/log/{pico}_{workflow}.log
log4j.appender.a.layout=com.digitalroute.apl.log.JsonLayout
log4j.appender.a.layout.MdcFieldsToLog=pico, workflow, agent, tag

...

Info
titleExamples Appender Configurations


Code Block
# Default
log4j.appender.Default=com.digitalroute.apl.log.DRRollingFileAppender
log4j.appender.Default.file=${mz.home}/log/log4j/{workflow}.log
log4j.appender.Default.layout=org.apache.log4j.PatternLayout
log4j.appender.Default.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss,SSS}];[%-5p];[pico=%X{pico}];[%t];[tag=%X{tag}];[%c]:%m%n
log4j.appender.Default.MaxFileSize=10MB
log4j.appender.Default.MaxBackupIndex=20
log4j.logger.aplLogger.Default=TRACE, Default

The appender named Default will write a single file for all workflows contained under the Default folder.

Code Block
# PRIMARY
log4j.appender.PRIMARY=com.digitalroute.apl.log.DRRollingMultiFileAppender
log4j.appender.PRIMARY.file=${mz.home}/log/log4j/{workflow}.log
log4j.appender.PRIMARY.layout=org.apache.log4j.PatternLayout
log4j.appender.PRIMARY.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss,SSS}];[%-5p];[pico=%X{pico}];[%t];[tag=%X{tag}];[%c]:%m%n
log4j.appender.PRIMARY.MaxFileSize=10MB
log4j.appender.PRIMARY.MaxBackupIndex=20
log4j.logger.aplLogger.RT_Folder.RT_TEST_WF=TRACE, PRIMARY

The appender named Primary will create multiple files; one for each workflow instance based on the RT_Folder.RT_TEST_WF workflow.

Code Block
# SECONDARY
log4j.appender.SECONDARY=com.digitalroute.apl.log.DRRollingFileAppender
log4j.appender.SECONDARY.file=${mz.home}/log/log4j/{workflow}.log
log4j.appender.SECONDARY.layout=org.apache.log4j.PatternLayout
log4j.appender.SECONDARY.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss,SSS}];[%-5p];[pico=%X{pico}];[%t];[tag=%X{tag}];[%c]:%m%n
log4j.appender.SECONDARY.MaxFileSize=10MB
log4j.appender.SECONDARY.MaxBackupIndex=20
log4j.logger.aplLogger.RT_Folder.RT_TEST_WF=TRACE, SECONDARY

The appender Secondary will  create a single file for each workflow instance based on the RT_Folder.RT_TEST_WF workflow. The file will take the name of the first workflow instance it encounters, for example "RT_Folder.RT_TEST_WF.workflow_1" 

...

Tip
titleHint!

You can change the maximum file size and the number of backup files by adding the following lines:
log4j.appender.a.MaxFileSize=100MB
log4j.appender.a.MaxBackupIndex=10

You can add a filtering rule by adding the line log4j.logger.<configuration name>=<log level>. This is useful when you want to set different log levels for specific folders or configurations.

Info
titleExample. Sets the general log level to ERROR and to DEBUG for the agent named agent_1

log4j.rootLoggerlogger.aplLogger=ERROR, a 
log4j.appender.a=com.digitalroute.apl.log.DRRollingFileAppender
log4j.appender.a.file=${mz.home}/log/{pico}_{workflow}.log
log4j.appender.a.layout=com.digitalroute.apl.log.JsonLayout
log4j.logger.Default.debug.workflow_1.agent_1=DEBUG


If you want to apply the filtering rule to all APL configurations in the default folder, change the last line in the previous example to log4j.logger.Default=DEBUG.

...