How to redirect scriptrunner log to another file

I am trying to modify log4j.properties so all debugging from scriptrunner addon can be redirected to a separate file , not in atlassian-jira.log.

I have tried this, but no groovy.log is created under log subdirectory of the JIRA HOME directory:

log4j.appender.GroovyLog=com.atlassian.jira.logging.JiraHomeAppender
log4j.appender.GroovyLog.File=groovy.log
log4j.appender.GroovyLog.MaxFileSize=20480KB
log4j.appender.GroovyLog.MaxBackupIndex=5

log4j.appender.GroovyLog.layout=org.apache.log4j.PatternLayout
log4j.appender.GroovyLog.layout.ConversionPattern=%d %t %p [%c{4}] %m%n
log4j.appender.GroovyLog.Threshold=DEBUG

log4j.category.com.onresolve.jira.groovy = DEBUG, console, GroovyLog
log4j.additivity.com.onresolve.jira.groovy = false

 

If instead I replace the first 2 lines for this:

log4j.appender.GroovyLog=org.apache.log4j.RollingFileAppender
log4j.appender.GroovyLog.File=${catalina.home}/logs/groovy.log

It does create groovy.log under the logs subdirectory of the JIRA INSTALLATION directory.

I need groovy.log to be where all application logs are in the log subdirectory of the JIRA HOME directory.

Thanks in advance,

1 answer

1 accepted

0 vote

Hi Adolfo,

I understand you are looking to have scriptrunner create its logs in the $JiraHome/log/ folder instead of the default here in the $JiraInstall/logs/ folder.

The way this could be done would be to create a new variable for the Jira home directory.   By default the setup and installation of Jira doesn't always require Jira installations set this variable manually.  Most times it is not set explicitly, but you can follow How do I set my JIRA home? in order to create an operating system variable called JIRA_HOME. 

The 3rd bullet point on that page has these instructions on how to do this.  Depending on whether this is a Windows vs Linux system the steps on how do to this are slightly different.  But either way you can define this to the specific path of your JIRAHOME path and then at that point you can use the $JIRA_HOME/log path in your script as a means to log files there.

 

Set an environment variable named JIRA_HOME in your operating system whose value is the location of your JIRA home directory. To do this:

  • On Windows, do one of the following:
    • Configure this environment variable through the Windows user interface (typically through 'My Computer' or 'Computer')
    • At the command prompt, enter the following command (with your own JIRA Home path) before running JIRA from the command prompt:
      • set JIRA_HOME=X:\path\to\JIRA\Home
        (warning) Please set your JIRA_HOME  environment variable value using this format, where:
        • X is the drive letter where your JIRA Home Directory is located and
        • no spacing has been added around the equal sign ('=')
    • Specify the command above in a batch file used to start JIRA.
  • On Linux/Solaris, do one of the following:
    • Enter the following command at a shell/console prompt (with your own JIRA Home path) before running JIRA:
      • export JIRA_HOME=/path/to/jira/home
    • Specify the command above in a script used to start JIRA.

 

 

I hope this helps.

Andy

Hi Andrew,

Finally I got it wot work. Using JIRA_HOME didn't work for me, but this does:

log4j.appender.GroovyLog.File=${jira.home}/log/groovy.log

I set JIRA_HOME but log4j didn't translate it to the actual directory. On the other hand I noticed jira.home is set within the jira startup script, so I used that instead and work OK.

thanks.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

689 views 6 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you