Log4j not working with AS7.4 bundled with JDS 8.1.0.GA
nathan.clark Oct 8, 2015 7:31 PMI've read some statements on here suggesting that JBoss AS versions after 7.1 auto-detect and configure log4j logging, smoothing out some issues with previous releases. My understanding is that to get this behavior, you remove log4j.jar from the deployment (so that you get the container-supplied implementation of log4j), and leave your log4j.xml in the classpath where it always was. During application deployment all application archives are scanned for log4j (or slf4j or JUL) configurations, and if those are found, their configuration info is used seamlessly. Of course, in this scenario you would not exclude the container logging module, and you would not touch the "org.jboss.as.logging.per-deployment" flag.
This is not working for me. My log4j.xml defines System.out and System.err appenders, as well as a rolling file appender. The file doesn't get created, and none of the log4j output appears in the console. No errors related to the application logging config appear in the JBoss server log. Are my assumptions correct? What else could be wrong?
This application has been in production for 8 years on WAS, and the logging of course works there. A migration to JBoss AS 5 was begun, never completed (I don't know if logging ever worked there.) The JBoss AS 5 migration was then re-targetted for AS 7 in mid-stream. That's the effort I'm now working to complete.
Perhaps I should stress that I'm doing this in the JBoss Developer Studio using the built-in server. Oddly, I have to keep the log4j jar present in the workspace (because I can't seem to be able to import it from the EAP), but avoid it getting into the Deployment Assemblies. (A secondary issue I'd like to resolve: is there some JBoss library I can pull into the workspace to satisfy this Eclipse-level dependency?)
I should also mention that converting all the logging code to the new JBoss-proprietary loggers is not an option at this time.
One more thing: the log4j version previously used was 1.2.14, so the log4j.xml structure presumably conforms to that.