access logging to separate file with bamboo

Bamboo version 5.0.1

I have access logging going to a separate file (atlassian-bamboo-access.log) with a second appender, but the access logging still shows up in the standard logs (atlassian-bamboo.log).

Here is my log4j.properties:

#
# Change the following line to configure the bamboo logging levels (one of INFO, DEBUG, ERROR, FATAL)
#
log4j.rootLogger=WARN, bamboolog

#using 'bamboo home aware' appender. If the File is relative a relative Path the file goes into {bamboo.home}/logs


log4j.appender.bamboolog=com.atlassian.bamboo.log.BambooRollingFileAppender
log4j.appender.bamboolog.File=/opt/atlassian/logs/bamboo/atlassian-bamboo.log
log4j.appender.bamboolog.MaxFileSize=61440KB
log4j.appender.bamboolog.MaxBackupIndex=20
log4j.appender.bamboolog.layout=org.apache.log4j.PatternLayout
log4j.appender.bamboolog.layout.ConversionPattern=%d %p [%t] [%c{1}] %m%n


# This log below gives more correct line can class details
#log4j.appender.console.layout.ConversionPattern=%d %p [%t] [%C{1}:%L] %m%n
#log4j.appender.bamboolog.layout.ConversionPattern=%d %p [%t] [%C{1}:%L] %m%n

########################################################################################################################
# Access Log
########################################################################################################################
log4j.category.com.atlassian.bamboo.filter.AccessLogFilter=INFO, accesslog
log4j.additivity.com.atlassian.bamboo.util.AccessLogFilter=false


log4j.appender.accesslog=org.apache.log4j.RollingFileAppender
log4j.appender.accesslog.Threshold=DEBUG
log4j.appender.accesslog.File=/opt/atlassian/logs/bamboo/atlassian-bamboo-access.log
log4j.appender.accesslog.MaxFileSize=61440KB
log4j.appender.accesslog.MaxBackupIndex=20
log4j.appender.accesslog.layout=org.apache.log4j.PatternLayout
log4j.appender.accesslog.layout.ConversionPattern=%d %p [%t] [%c{1}] %m%n

The WEB-INF/web.xml:

<filter>
    <filter-name>accessLogFilter</filter-name>
    <filter-class>com.atlassian.bamboo.filter.AccessLogFilter</filter-class>
  </filter>
 
  <filter-mapping>
    <filter-name>accessLogFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

Again, everything logs correctly to the atlassian-bamboo-access.log file, but I'm also seeing the access logging in the standard logs - which I would like to stop - so that access logging only goes to the access logs. 

I suppose I should say I took this from the Confluence docs and modified the classes use "bamboo" instead of "confluence" so I'm guessing there may be a difference I'm not accounting for.

Ideas?

 

2 answers

I have also tried with log4j.appender.bamboolog=org.apache.log4j.RollingFileAppender

Figured this out, if anyone is interested in bamboo access logging to unique file. There's a very solid chance it was working in the above example, but the declared logging location wasn't where I expected it to be smile

 

########################################################################################################################
# Application Log
########################################################################################################################


log4j.rootLogger=INFO, bamboolog
log4j.appender.bamboolog=com.atlassian.bamboo.log.BambooRollingFileAppender
log4j.appender.bamboolog.File=/opt/atlassian/logs/bamboo/atlassian-bamboo.log
log4j.appender.bamboolog.MaxFileSize=61440KB
log4j.appender.bamboolog.MaxBackupIndex=20
log4j.appender.bamboolog.layout=org.apache.log4j.PatternLayout
log4j.appender.bamboolog.layout.ConversionPattern=%d %p [%t] [%c{1}] %m%n


########################################################################################################################
# Access Log
########################################################################################################################


log4j.appender.accesslog=org.apache.log4j.RollingFileAppender
log4j.appender.accesslog.Threshold=DEBUG
log4j.appender.accesslog.File=/opt/atlassian/logs/bamboo/atlassian-bamboo-access.log
log4j.appender.accesslog.MaxFileSize=61440KB
log4j.appender.accesslog.MaxBackupIndex=20
log4j.appender.accesslog.layout=org.apache.log4j.PatternLayout
log4j.appender.accesslog.layout.ConversionPattern=%d %p [%t] [%c{1}] %m%n

log4j.category.com.atlassian.bamboo.filter.AccessLogFilter=INFO, accesslog
log4j.additivity.com.atlassian.bamboo.filter.AccessLogFilter=false

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Dec 06, 2018 in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

5,678 views 22 17
View question

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