Some Log4j Custom Filters stopped Working in Confluence 8

XMLWordPrintable

    • 4
    • Severity 3 - Minor
    • 0

      Problem

      Some Customer Log4j filters stopped working in Confluence 8

      Environment

      Reproduced in Confluence DC 8.5.2
      Not reproduced on Confluence DC 7.19.x

      Steps to Reproduce

      adding a custom filter in Log4j such as below 3 lines

      log4j.appender.confluencelog.filter.1=org.apache.log4j.varia.StringMatchFilter
      log4j.appender.confluencelog.filter.1.StringToMatch=ready to serve
      log4j.appender.confluencelog.filter.1.AcceptOnMatch=false
      

      So that the atlassian-confluence.log part looks like this in log4j.properties

      log4j.properties
      [...]
      log4j.appender.confluencelog.LogFileName=atlassian-confluence.log
      log4j.appender.confluencelog.Threshold=DEBUG
      log4j.appender.confluencelog.MaxFileSize=20480KB
      log4j.appender.confluencelog.MaxBackupIndex=5
      log4j.appender.confluencelog.layout=com.atlassian.confluence.util.PatternLayoutWithContext
      log4j.appender.confluencelog.layout.ConversionPattern=%d %p [%t] [%c{4}] %M %enc{%m}{JSON}%n
      log4j.appender.confluencelog.filter.1=org.apache.log4j.varia.StringMatchFilter
      log4j.appender.confluencelog.filter.1.StringToMatch=ready to serve
      log4j.appender.confluencelog.filter.1.AcceptOnMatch=false
      [...]
      

       

      Expected Results

      The same change when applied in Confluence 7.19.11 for instance will remove the line Confluence is ready to serve from the atlassian-confluence.log 

      Actual Results

      Does not filter the application logs and I can still see the line below after applying the change

      atlassian-confluence.log
      [...]
      2023-09-27 16:32:11,910 INFO [Catalina-utility-2] [com.atlassian.confluence.lifecycle] init Confluence is ready to serve
      [...]
      

      reference KB: 

      Workaround

      Relying on external scripts to perform the logs filtering can help but defeats the purpose of administrating this from the Application itself

            Assignee:
            Unassigned
            Reporter:
            Pascal Oberle
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: