change location of Bitbucket log direcotry

SW August 4, 2017

Defaultly the logs are stored under the Bitbucket Home directory. As the orgnistaions design we are forced to keep logs files in specific drive. 

For this I need to changes the ${log.dir} location.

I see following line in logback.xml but do not know how do I give value to log dir,

 

<define name="log.dir" class="com.atlassian.stash.internal.logback.LogDirectoryPropertyDefiner"
scope="context"/>

 

Help me to change the default log location

Platform is windows.

2 answers

1 vote
Jesse_Norris May 30, 2020

Late to the party, but I've found a solution that should be documented. I was running into the same issue of not wanting to repeat the same location in multiple appender definitions. I was able to solve it by defining a variable in the logback.xml file.

Since Bitbucket Server uses Logback as its logging utility, I followed the Variable Substitution section of the Logback Configuration Documentation.

<property name="mylog.dir" value="/var/log/bitbucket"/>

Instead of the <define> tag that Atlassian uses to import their pre-defined variables (like log.dir), Logback can also use the <property> tag to define a local variable that can then be access using ${mylog.dir}.

This can then be used in an appender definition such as the following:

<appender name="bitbucket.application" class="ch.qos.logback.core.FileAppender">
    <file>${mylog.dir}/atlassian-bitbucket.log</file>
</appender>

Alleviating the need to repeat the same location many times!

I've done this successfully on Bitbucket Server 7.2 within the local logback.xml file within my <bitbucket-home> directory. I'm not sure if this solution was a possibility back in Bitbucket Server 5.2 from the other answer.

0 votes
Lars Olav Velle
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.
August 4, 2017

https://confluence.atlassian.com/bitbucketserverkb/configure-bitbucket-server-logging-779171678.html

In atlassian-bitbucket-5.2.2/app/WEB-INF/classes/logback.xml change:

<file>${log.dir}/atlassian-bitbucket.log</file>

SW August 4, 2017

Thanks for the reply Velle. 

I was already went through the article but did not wanted to specify locations at multiple files tags :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events