What is RIGHT way to load Log4j so that application code uses it and not Jboss logging
stevecoh Aug 18, 2014 3:03 PMI am trying to port a system from WebLogic to JBoss EAP v.6.2.
This system is composed of a large number of related small applications (some WARs, some EARs). The basic requirement is to minimize the changes required. One of the fundamental aspects of the system that we are reluctant to change is that all log4j calls are wrapped in a few classes in one jar, which is the only place that dependencies on org.apache.log4j exist. In Web Logic this jar is included on the classpath when the server starts.
This does not work with JBoss. I am trying to port first one simple application, a web app. For this deployment, the jboss-deployment-structure.xml adds a dependency on com.whatever.log4j. Then I have defined a module for this jar that has a dependency on org.apache.log4j. My module is loaded by JBoss without incident, but then when I invoke anything on the web app there is an exception preventing load at the line where a call to getLogger() gets made. This is delegated within the log4j wrapper jar to a call to log4j's getLogger(), and then JBoss shuts the application down.
I have tried many things, adding a module in the system tree (modules/system/layers/base), as a module of my own (modules/com/whatever ...) and in call cases the application dies because it is unable to find system:main.
One thing I have not tried and don't want to try is JBoss's recommended solution of putting log4j.jar in the war file for the web app. That may be good advice for a single war deployment, but we don't want to do it when the server will be running hundreds of applications.
To put it bluntly, we want to DEFEAT JBoss's recommendation that all logging go through its logging framework and replace that with an implementation in which all application logs are handled directly with log4j. It's ok if JBoss itself uses its own framework. But I can't figure out what the module structure needs to look like for this.
I don't want to keep "trying this and trying that". Is there detailed documentation explaining all the ins and outs of module descriptors and jboss deployment structure descriptors? I want to understand it. But the JBoss docs don't go into that level of detail.
Message was edited by: Steve Cohen