Why is the WildFly console log hijacking my WAR's log4j log?

Viewed 768

I have 7 different WARs deployed to the same WildFly / JBoss server. Each WAR is identical in core design and Log4j configuration. Each WAR generates its own log file via its own individual custom log4j.xml. Each log is written to an individual folders.

1 of the 7 deployed WARs keeps getting the logging hijacked by WildFly's console.log. It will begin writing to its own log for 5-10 lines during initialization, then stop; the rest of the logging will be directed to the console.log.

If I re-install the WAR after this happens, it will write to both its own individual log and the WildFly console.log. If I restart WildFly, it will behave as described previously - begin logging to its own log, then continue on console.log.

The only thing unique about this WAR vs the other 6 is that this project uses JAXB; none of the other WARs use JAXB.

Is there some sort of unknown interaction between JAXB and Log4j and WildFly that might be causing this? I suspect, but cannot yet prove, the hijack is happening after the classes using JAXB are loaded by the ClassLoader.

jboss-7.2.0.Final , jdk-7u80x64, Log4j-1.2.13.jar

2 Answers

You may need to try move the logging.properties file to the WAR/WEB-INF/classes. I guess old Jboss EAP 6.4, There may have been a bug where it fails to look in the WAR/WEB-INF directory.

If that doesn't work you have to turn on trace logging for org.jboss.as.logging which should show the logging.properties file is found in your deployment.

The following CLI command will enable trace logging to see the details of what the logging subsystem is doing.

/subsystem=logging/logger=org.jboss.as.logging:add(level=TRACE)

If you want to see these log messages on the console you'll need to enable trace logging for the console tool.

/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level, value=TRACE)

resources:

sect-per-deployment_logging

Logging Configuration

Solved by excluding the log4j module from the application via /WEB-INF/jboss-deployment-structure.xml

<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.apache.log4j" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>
Related