Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't add logs into different file

Nilufar December 3, 2020

Hi,

I want to add the logs to separate log file for all scripts  in <jira-home>/scripts/mypackage

I have added the following into  log4j.properties:


log4j.appender.GWLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.GWLogger.File=mylogs.log
log4j.appender.GWLogger.MaxFileSize=20480KB
log4j.appender.GWLogger.MaxBackupIndex=5
log4j.appender.GWLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.GWLogger.layout.ConversionPattern=%d %t %p %X{{system-name}.username} [%c{4}] %m%n
log4j.appender.GWLogger.datePattern='.'yyyy-MM-dd-HH-mm

log4j.logger.com.Mylogger=DEBUG, console,GWLogger

 And also added the following into my script:

import org.apache.log4j.Logger

def log = Logger.getLogger("com.Mylogger")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug "debug statements"

 

It added logs into  atlassian-jira.log instead of creating new log file with name mylogs.log and adding logs into it. 

I tried to follow the instructions from Advanced logging , it did not worked, Can anyone help me please?

1 answer

1 accepted

0 votes
Answer accepted
Nilufar December 7, 2020

I  restarted  Jira after updating  log4j.properties. That worked well.

 Br

Nilufar

Suggest an answer

Log in or Sign up to answer