How to add advanced logging


Setting up advanced logging is strongly recommended

Validators and post functions have virtually no opportunity to provide error feedback except via logging. Atlassian Command Line Interface (CLI) actions can be complex and may access remote systems which can increase problem determination difficulties. The add-on provides lots of information to the JIRA log to help with problem determinate, however, it is much better to add the advanced logging capabilities to provide a separate log file for easier function configuration and future problem determination.

Description

Advanced logging is available to provide an audit trail and help with problem determination. It is highly recommended that logging be enabled.

Steps

To enable, add the following section or similar to your log4j.properties file normally located in <jira-installation-directory>/atlassian-jira/WEB-INF/classes

Add logging section to log4j.properties
# Run CLI actions logging
log4j.appender.runcliactions=com.atlassian.jira.logging.JiraHomeAppender
log4j.appender.runcliactions.File=run-cli-actions.log
log4j.appender.runcliactions.Threshold=INFO
log4j.appender.runcliactions.MaxFileSize=20480KB
log4j.appender.runcliactions.MaxBackupIndex=10
log4j.appender.runcliactions.layout=org.apache.log4j.PatternLayout
log4j.appender.runcliactions.layout.ConversionPattern=%d %p: %m%n

log4j.logger.org.swift.jira.acli.utilities.CliRunnerHelper.action=INFO, runcliactions
# set the following to true if you also want actions logged to the main jira log
log4j.additivity.org.swift.jira.acli.utilities.CliRunnerHelper.action=false
Example logging data
2012-07-18 07:46:24,404 INFO: 
Issue:     ZJCLIP-3
User:      admin
Context:   validator
Product:   JIRA
Action:    --action getFieldValue --issue ZJCLIP-3 --field priority --server http://imac2.local:8215 --user automation --password ***
Pattern:   value:\s+(\S+)
Pattern:   value:\s+((?:Critical)|(?:Blocker))
Result:    SUCCESS
           Issue ZJCLIP-3 has field 'priority' with value: 
Major (3)

Message:   This transition is only allowed for issues with Critical or Blocker priorities. The priority for this item is Major.

Logs

Resulting logs, by default, will be located in the same directory as the server application logs, usually in ,,./home/log.