Log4j 2
  1. Log4j 2
  2. LOG4J2-106

log4j2 configuration reloading does not work when log4j xml is not in classpath

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta2
    • Fix Version/s: 2.0-beta3
    • Component/s: None
    • Labels:
      None

      Description

      I am testing log4j2 on JBOSS EAP 5.0. I have copied log4j2.xml in JBOSS_HOME\server\default\conf and add the system property in eclipse server launch configuration as below:

      -Dlog4j.configurationFile=C:\softwares\jboss-eap-5.0.1\jboss-eap-5.0\jboss-as\server\default\conf\log4j2.xml

      if i modify log4j.xml and change log level etc. those changes are not picked up by log4j. below is my log4j2.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration name="log4j2-Test" status="DEBUG" monitorInterval="5" strict="true">
      <appenders>
      <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d

      {HH:mm:ss.SSS}

      [%t] %-5level %logger

      {36}

      - %msg%n"/>
      </Console>
      </appenders>
      <loggers>
      <logger name="com.xyz" level="DEBUG" >
      <appender-ref ref="Console"/>
      </logger>
      <root level="error">
      <appender-ref ref="Console"/>
      </root>
      </loggers>
      </configuration>

        Activity

        Anand Awasthi created issue -
        Hide
        Ralph Goers added a comment -

        Thanks. After glancing at the code I don't think this is specific to JBoss.

        Show
        Ralph Goers added a comment - Thanks. After glancing at the code I don't think this is specific to JBoss.
        Hide
        Anand Awasthi added a comment -

        I think so too. Has anyone experienced this before. I am debugging the source code and does not look like that log4J context even picks up the configuration file.

        Show
        Anand Awasthi added a comment - I think so too. Has anyone experienced this before. I am debugging the source code and does not look like that log4J context even picks up the configuration file.
        Hide
        Ralph Goers added a comment -

        Many of the unit tests use the system property so it does get picked up. But the File object isn't being passed to the constructor so File monitoring probably isn't working. I suspect I broke this when in a prior fix. This should have been caught by a unit test.

        BTW - you have strict="true" in your configuration but then you aren't using the strict syntax.

        Show
        Ralph Goers added a comment - Many of the unit tests use the system property so it does get picked up. But the File object isn't being passed to the constructor so File monitoring probably isn't working. I suspect I broke this when in a prior fix. This should have been caught by a unit test. BTW - you have strict="true" in your configuration but then you aren't using the strict syntax.
        Hide
        Anand Awasthi added a comment -

        thanks, can you put that fix back.

        Show
        Anand Awasthi added a comment - thanks, can you put that fix back.
        Hide
        Anand Awasthi added a comment -

        any update on this. BTW, which constructor are you talking about. thanks

        Show
        Anand Awasthi added a comment - any update on this. BTW, which constructor are you talking about. thanks
        Hide
        Ralph Goers added a comment -

        I checked in a fix last night but I have some more testing to do.

        Show
        Ralph Goers added a comment - I checked in a fix last night but I have some more testing to do.
        Hide
        Ralph Goers added a comment -

        I added a unit test that verifies that the configuration can be located as a File and then be reconfigured. Please verify and close.

        Show
        Ralph Goers added a comment - I added a unit test that verifies that the configuration can be located as a File and then be reconfigured. Please verify and close.
        Ralph Goers made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
        Fix Version/s 2.0-beta3 [ 12323368 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Anand Awasthi
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development