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

Automatic Reconfiguration not working when edit and save log4j2.xml in NetBeans /build/WEB-INF

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 2.5
    • None
    • Configurators
    • None
    • Mac OS X
      NetBeans8.1
      Glassfish4.1.1

    Description

      With a NetBeans web app deployed over the project's build folder (not as a separate deployed WAR).

      From https://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticReconfiguration:

      When configured from a File, Log4j has the ability to automatically detect changes to the configuration file and reconfigure itself. If the monitorInterval attribute is specified on the configuration element and is set to a non-zero value then the file will be checked the next time a log event is evaluated and/or logged and the monitorInterval has elapsed since the last check. The example below shows how to configure the attribute so that the configuration file will be checked for changes only after at least 30 seconds have elapsed. The minimum interval is 5 seconds.

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration monitorInterval="5" >
      ...
      </Configuration>
      

      But when I edit and save the /build/web/WEB-INF/classes/log4j2.xml nothing happens, the Automatic Reconfiguration magic fails. The log4j2.xml is otherwise found and seems to work fine.

      When I use:

      <Configuration status="ALL" monitorInterval="5">
      

      and the webapp deployed directly from NetBeans8.1 into Glassfish4.1.1 (over the .../build) I get:

      admin-listener(2) DEBUG Configuration XmlConfiguration[location=/Users/.../webapp/build/web/WEB-IN‌​F/classes/log4j2.xml‌​] initialized. 
      

      But editing the log levels in that log4j2.xml file does not get caught.

      Attachments

        Activity

          People

            Unassigned Unassigned
            webel Darren Kelly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: