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

Configuration resolution when JSON libraries are not present skips XML file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.7
    • None
    • Configurators
    • None

    Description

      Servlet 3.1 application built with maven with log4j2.xml in src/main/resources. Works as expected when deployed to tomcat. Then I add a dependency that has its own log4j2.json file. The log4j2 config resolution picks that file before my xml file. I then exclude the jackson json libraries thinking that log4j will skip the json file and read my xml file. Instead, I get the message: "ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console."

      I believe you can achieve the same result by putting both a log4j2.xml and log4j2.json file in your classpath and not including the jackson libraries.

      It would be great if log4j could at least warn the user that it is short circuiting configuration resolution because it found a json configuration without any jackson libraries to read it.

      Attachments

        Activity

          People

            Unassigned Unassigned
            cash Cash Costello
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: