Enabling JEMH logging

Sometimes you may want more information about the processing of an email than you get from the Auditing report. Additional information can be configured to be logged out to a file. There are 2 methods for enabling logging:

Output to a dedicated log file

Pre Jira 9.5.0 Log4j2 properties configuration

recommended restart required

With the following configuration, Jira will create a su.log file in JIRA_HOME/log.  A Jira restart will be required to make the changes apply.

  1. Go to your JIRA_INSTALL_DIR/atlassian-jira/WEB-INF/classes/log4j.properties file

  2. Add the following lines to the bottom of the file:

    # --------------------- # JEMH LOGGING STARTS log4j.appender.JEMHFileLog=com.atlassian.jira.logging.JiraHomeAppender log4j.appender.JEMHFileLog.File=jemh.log log4j.appender.JEMHFileLog.MaxFileSize=20480KB log4j.appender.JEMHFileLog.MaxBackupIndex=5 log4j.appender.JEMHFileLog.layout=org.apache.log4j.PatternLayout log4j.appender.JEMHFileLog.layout.ConversionPattern=%d %t %p [%c{4}] %m%n log4j.appender.JEMHFileLog.Threshold=DEBUG log4j.logger.com.javahollic.jira.emh=DEBUG, JEMHFileLog log4j.additivity.com.javahollic.jira.emh=false log4j.logger.com.thepluginpeople.jemh.transport=DEBUG, JEMHFileLog log4j.additivity.com.thepluginpeople.jemh.transport=false # JEMH LOGGING ENDS # --------------------
  3. Save your changes and restart Jira

  4. Logs can be found in the JIRA_INSTALL_DIR/home/log (not to be confused with JIRA_INSTALL_DIR/logs)

Changing the amount of data logged

The steps above set logging to the default level (DEBUG). This means that all extra information will be saved to the log file. To reduce the amount of logging, the level can be changed. Changing the level requires a Jira restart. The following levels can be set:

  • DEBUG (most information)

  • INFO

  • WARN

  • ERROR (least information)

Using Jira 9

Jira 9 needs the ‘log4j.appender.JEMHFileLog.layout’ to be set as:

log4j.appender.JEMHFileLog.layout=com.atlassian.logging.log4j.NewLineIndentingFilteringPatternLayout

Jira 9.5.0 and above Log4j2 XML configuration

restart required

Jira 9.5.0 has upgraded the Log4j runtime logging library to version 2. Log4j2 uses XML configuration file format. With the following configuration, Jira will create a jemh.log file in JIRA_HOME/log.  A Jira restart will be required to make the changes apply.

  1. Go to your JIRA_INSTALL_DIR/atlassian-jira/WEB-INF/classes/log4j2.xml file

  2. Add the following lines above the closing Appenders tag </Appenders> (around line number 257) :

    <!-- #####################################################--> <!-- # JEMH APPENDER STARTS--> <!-- #####################################################--> <JiraHomeAppender name="JEMHFileLog" fileName="jemh.log" filePattern="jemh.log.%i"> <PatternLayout alwaysWriteExceptions="false"> <Pattern> %d %t %p [%c{4}] %m%n </Pattern> </PatternLayout> <Policies> <SizeBasedTriggeringPolicy size="20480KB"/> </Policies> <DefaultRolloverStrategy fileIndex="min" max="5"/> </JiraHomeAppender> <!-- #####################################################--> <!-- # JEMH APPENDER ENDS--> <!-- #####################################################-->
  3. Add the following lines above the closing Loggers tag </Loggers> (at the bottom, around line number 839) :

    <!-- #####################################################--> <!-- # JEMH LOGGER REF STARTS--> <!-- #####################################################--> <Logger name="com.javahollic.jira" level="DEBUG" additivity="false"> <AppenderRef ref="JEMHFileLog"/> </Logger> <!-- #####################################################--> <!-- # JEMH LOGGER REF ENDS--> <!-- #####################################################-->

Output to the existing Atlassian log file

no restart required

Whilst we recommend the first method as it outputs to a separate log file, if restarting Jira is not an option it can still be enabled temporarily.

  1. Go to Jira Administration > System > Logging and profiling

  2. Under Default Loggers, select configure logging level for another package

  3. For Package name enter com.javahollic.jira.emh

  4. For Logging Level select DEBUG

  5. Press Add to save

  6. JEMH log output will now be added to Jira's own atlassian-jira.log file

Related Articles