Scriptrunner advanced logging custom logger

ITDev January 29, 2021

Hi, I made the settings described in the article https://scriptrunner.adaptavist.com/6.18.0/jira/advanced-logging.html step 2. And now scriptrunner logs writes to ScriptRunnerLogFile.log, but when I define custom logger in scriptrunner listener, for example 

import org.apache.log4j.Level
import org.apache.log4j.Logger

 

def log = Logger.getLogger("GetWorkflowStep")
log.setLevel(Level.DEBUG)

log.debug ("Test log")

the log is written to the standard atlassian-jira.log file, not to ScriptRunnerLogFile.log

So, what I did wrong?

Thanks

3 answers

2 accepted

1 vote
Answer accepted
Joe Baldwin February 5, 2021

Hi there, 

I can confirm that changing your script from: 

def log = Logger.getLogger("GetWorkflowStep")

to:

def log = Logger.getLogger("com.onresolve.GetWorkflowStep")

will allow you to print your desired logs to the ScriptRunnerLogFile.log file instead of the atlassian-jira.log file. 

Please remember to restart your JIRA instance once you've made the above changes. 

Kind regards, 

Joe

1 vote
Answer accepted
Italo Qualisoni [e-Core]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2021

I have a feeling that the documentation makes all logs that starts with com.onresolve to your ScriptRunnerLogFile.log file. This is due the log4j suggested changes they documented in their KB;

Can you try the following code?

import org.apache.log4j.Level
import org.apache.log4j.Logger


def log = Logger.getLogger("com.onresolve.GetWorkflowStep")
log.setLevel(Level.DEBUG)

log.debug ("Test log")
0 votes
ITDev February 8, 2021

Thanks guys, that was very helpful!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13.0
TAGS
AUG Leaders

Atlassian Community Events