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

log4j2.xml not found by default in WEB-INF folder

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.3
    • Fix Version/s: 2.5
    • Component/s: Configurators
    • Labels:
      None
    • Environment:

      Tested on
      Windows 7 + Eclipse Juno + tomcat 7.0.62
      and
      CentOS 6.2 + tomcat 7.0.61

      Description

      I have a web application, included log4j-api-2.3, log4j-core-2.3 and log4j-web-2.3 and placed a log4j2.xml file in the WEB-INF folder.
      On application startup I receive the following message:
      ERROR StatusLogger No Log4j context configuration provided. This is very unusual.
      ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

      When I add
      <context-param>
      <param-name>log4jConfiguration</param-name>
      <param-value>/WEB-INF/log4j2.xml</param-value>
      </context-param>
      to my web.xml the error notification disappears.

      According to the documentation at http://logging.apache.org/log4j/2.x/manual/webapp.html Log4J2 should search a file starting with log4j2 in the WEB-INF folder if no context-param is specified.
      It seems, this does not happen.

        Attachments

          Activity

            People

            • Assignee:
              rpopma Remko Popma
              Reporter:
              pzim Patrick Zimmermann
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: