Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3181

When custom configurationFile is missing then no fallback configuration is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.13.0
    • None
    • Configuration
    • None

    Description

      So I am using following setting to define 'external' logger configuration file

      -Dlog4j.configurationFile=/etc/xxx/log4j2.properties
      

      I also put a default config inside the package with assumption to use it as a fallback, however if the 'external' configuration file does not exist following occurs:

      ERROR StatusLogger File not found in file system or classpath: /etc/xxx/log4j2.properties
      ERROR StatusLogger Reconfiguration failed: No configuration found for '27bc2616' at 'null' in 'null'

      and as a result logger is not configured at all and not logging anything, despite the fallback config is inside the package. There is a similar problem described in following SO ticket

      In such situation I would expect log4j2 to follow the automatic configuration path as defined here: https://logging.apache.org/log4j/2.x/manual/configuration.html
      and use properties from class path or if those not found to fallback to a default settings. If not as a default behavior there at least should be way to force it to work that way.

      Note that there is also a second issue, if define multiple configs via configurationFile, even if single of those fails to be found then same issue as above happens, and we get no configuration at all.

      Attachments

        Activity

          People

            rgoers Ralph Goers
            KG Krzysztof G─ůsior
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: