Previous versions of JBoss EAP 6 carried a bug that prevented the `System.out.println()` method from printing to log files when per-deployment logging was in use. This bug was resolved with an upstream patch.
Say you have the file META-INF/log4j.xml:
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="FILE" class="org.apache.log4j.FileAppender">
<param name="File" value="test.log"/>
<param name="Append" value="true"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="ConversionPattern" value="%d %-5p [%c:%L] %m%n"/>
And then you do this in some application code:
This logging statement will not be logged on the console, server.log, or test.log. It's nowhere to be found.
This commit fixes the issue upstream:
But if that can't be backported as-is, then perhaps we need to figure out specifically what fixed the problem and use that to fix the issue in EAP 6.
Setting to ON_QA since upgrade should fix this
could you please provide a reproducer for this issue? I tried the log4j.xml from the description (with log4j quickstart example application) and the logging statement is always logged in console and server.log (for both EAP 6.2.0.GA and EAP 6.3.0.ER2).
Created attachment 890562 [details]
Reproducer maven project
To run reproducer, start JBoss and then run `mvn jboss-as:deploy`. If you have JBOSS_HOME set in the reproducer environment, you can run ./request.sh, and this will invoke a JAX-WS enpoint that will log some messages via Log4J as well as System.out.println(). The script will then print the last few lines of the isolated Log4J log file created by the application.
Before the patch is applied, the last line should be something like:
12:04:44,599 ERROR [some.other.LoggingClass] (http-/127.0.0.1:8080-1) ERROR
This is because the System.out.println() is not printed. When the patch is applied, you should see something like this as the last line:
12:09:52,566 INFO [stdout] (http-/127.0.0.1:8080-1) System.out goes here
Thank you, Kyle.
Verified with EAP 6.3.0 ER2.
Changed <literal></literal> tags in Doc Text to ticks (`) to fix Bug 1096865