When loaded, plugin logback.xml replaces installation logback.xml

Hello all,

I’ve upgraded from Bitbucket 4.1 to 5.5.0 and, since, have issues on logfiles.

At application start, everything is correct as you can see in following simplified lsof result

[root@hostname atlassian ]# lsof -p 5894,5915 | grep .log$
java    5915  scm    2w   REG              253,2   306398 1717693 /opt/apps/atlassian/bitbucket-home/log/launcher.log
java    5915  scm  248w   REG              253,2   958332 1717774 /opt/apps/atlassian/bitbucket-home/log/atlassian-bitbucket.log
java    5915  scm  249w   REG              253,2     7077 1717751 /opt/apps/atlassian/bitbucket-home/log/atlassian-bitbucket-profiler.log
java    5915  scm  250w   REG              253,2        0 1717749 /opt/apps/atlassian/bitbucket-home/log/atlassian-bitbucket-access.log
java    5915  scm  251w   REG              253,2    22352 1717801 /opt/apps/atlassian/bitbucket-home/log/audit/atlassian-bitbucket-audit.log
java    5915  scm  252w   REG              253,2       89 1717810 /opt/apps/atlassian/bitbucket-home/log/atlassian-bitbucket-mail.log

However, right after my plugin is loaded (bitbucket is still starting), i “loose” those open files to my custom log file

[root@ifrlatl-stsh atlassian ]# lsof -p 3465,3483 | grep .log$
java    3483  scm   57r   REG              253,2     4785 1717766 /opt/apps/atlassian/bitbucket-home/log/bitbucketHooks.log

Indeed, my custom logback.xml (bundled in src/main/resources/logback.xml) only declares one appender :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

	<appender name="bitbucketHooksAppender" class="ch.qos.logback.core.FileAppender">
		<file>${bitbucket.home.dir}/log/bitbucketHooks.log</file>
		<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
			<pattern>[%d] |%-5level| %class:%line || %msg%n</pattern>
		</encoder>
	</appender>
	
	<logger name="myPackage" level="DEBUG">
		<appender-ref ref="bitbucketHooksAppender" />
	</logger>
	
	<logger name="com.atlassian.bitbucket.integration.jira" level="DEBUG">
		<appender-ref ref="bitbucketHooksAppender" />
	</logger>

</configuration>

The application logback.xml does contain an entry to allow customer to define a custom part but it’s not specifically related to plugins but, more generally, to home.dir

 <!-- Lastly, give customers the ability to define *their own* logback.xml which will be processed in
                 addition to this one, giving them the ability to modify logging levels at will without forcing
                 them to modify Bitbuckets's files directly.

                 WARNING: Do not use ${home.dir}-style property replacement here. Because the returned String is
                 compiled into Java code by Janino internally, doing so causes backslashes to be removed on Windows
                 and results in logback.xml not being included even if it is present. Calling property("home.dir")
                 returns the same value but does so in a way that is safe to be compiled. -->
            <if condition='new java.io.File(property("home.dir"), "logback.xml").exists()'>
                <then>
                    <!-- Do not do the actual import here! Just set a property indicating we want to. That way,
                         logback.xml in the home directory can change logging levels set in _this_ logback.xml -->
                    <property name="include.local" value="true"/>
                </then>
            </if>

Then question is simple : how do you set a plugin logback.xml without overriding the bitbucket-install/app/WEB-INF/classes/logback.xml one ?

Did not find something usefull in examples ans tutorials.

Thanks