Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-20151

Custom logback.xml in MESH_HOME directory is not being loaded by Mesh nodes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 9.6.4
    • Mesh
    • None

      Issue Summary

      BSERV-14253 provided the ability to use MESH_HOME/logback.xml to add logging customization in Mesh, similar to Bitbucket. However, this custom file is not read without having to do a few changes to the startup arguments.

      Steps to Reproduce

      1. Create a logback.xml in MESH_HOME
        <included>
            <logger name="com.atlassian.bitbucket" level="DEBUG" />
        
            <appender name="my.mesh.app" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <encoder>
                    <charset>UTF-8</charset>
                    <pattern>%date %-5level [%thread] %request %logger{36} %m%n%ex</pattern>
                </encoder>
                <file>${log.dir}/my-custom-atlassian-mesh.log</file>
                <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
                    <fileNamePattern>${log.dir}/my-custom-atlassian-mesh-%d.%i.log</fileNamePattern>
                    <maxFileSize>100KB</maxFileSize>
                    <maxHistory>5</maxHistory>
                    <totalSizeCap>1MB</totalSizeCap>
                </rollingPolicy>
            </appender>
        
            <root level="WARN">
                <appender-ref ref="my.mesh.app"/>
            </root>
        </included>
        
      2. Start the Mesh node

      Expected Results

      The customization works and there is no warning that the custom logback file wasn't opened.

      # Only displayed when <configuration debug="true"> is set in logback-spring.xml
      11:52:44,587 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@448c8166 - Adding [file:/mesh/.home-1/logback.xml] to configuration watch list.
      11:52:44,604 |-INFO in ch.qos.logback.core.model.processor.DefineModelHandler - About to instantiate property definer of type [com.atlassian.bitbucket.mesh.logback.HomeDirPropertyDefiner]
      

      Actual Results

      The customization did not work. The logs warn that the custom logback file wasn't opened.

      # Only displayed when <configuration debug="true"> is set in logback-spring.xml
      10:23:57,166 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@4c5ae43b - Adding [file:/mesh/home.dir_IS_UNDEFINED/logback.xml] to configuration watch list.
      10:23:57,166 |-WARN in ch.qos.logback.core.joran.action.IncludeAction - Failed to open [file:/mesh/home.dir_IS_UNDEFINED/logback.xml]
      10:23:57,183 |-INFO in ch.qos.logback.core.model.processor.DefineModelHandler - About to instantiate property definer of type [com.atlassian.bitbucket.mesh.logback.HomeDirPropertyDefiner]

      Workaround

      In bin/_start-mesh.sh, define home.dir to the same path as MESH_HOME

      MESH_ARGS="-Dmesh.home=$MESH_HOME -Dhome.dir=$MESH_HOME"
      

              Unassigned Unassigned
              aaff5594b3eb Aedrian Escultura (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: