Piers, IIRC, JBoss 6, by default, prefers the parent class loaders over child class loaders. This means that, when a class path resource is referenced, it is first searched for in the server class loaders and _then_ in the web application class loader. This is similar to the default behavior in WebSphere and WebLogic, and counter to the default behavior in GlassFish and Tomcat (and even earlier versions of JBoss), which search for a resources _first_ in the web application class loader and _then_ in the server class loaders (IMO, the correct behavior).
The consequence of this is that the log4j.properties/log4j.xml file shipped with JBoss override the log4j.xml file shipped with your application. The solution is to configure JBoss to disable parent-first class loading. The method by which you do this has changed from one JBoss version to another. Used to be a setting in /WEB-INF/jboss-web.xml, but it looks like it may have been moved. You should consult the JBoss documentation for instructions on disabling parent-first class loading. Once you do this, for your application only, Log4j will use your configuration files (this only works if the Log4j JAR files are also included in your /WEB-INF/lib directory). Nick On May 22, 2013, at 5:17 PM, Remko Popma wrote: > Piers, > > To be honest, this sounds more like a question that should be directed to the > JBoss people... > > Kind regards, > Remko > > Sent from my iPhone > > On 2013/05/20, at 22:45, Piers Uso Walter <[email protected]> wrote: > >> Hi, >> >> I am migrating an application from JBoss 4 to JBoss 6 and stumble over the >> fact that log4j does not seem to be supported by JBoss 6 out of the box any >> more. >> >> I've researched this quite extensively on the web, but have only found >> questions from other people, no answers. I hope someone in the log4j >> community has successfully used log4j (1.2) with JBoss 6 and might be able >> to help. >> >> >> Our previous setup with a log4j.xml configuration file in >> server/default/conf/ no longer works. That configuration files does not seem >> to be detected and used by JBoss 6. >> Basic logging (as configured in server/default/deploy/jboss-logging.xml) >> works, but I have not been successful in configuring log4j appenders in that >> file. From what I understand, this file does not really configure log4j, as >> JBoss 6 uses a new logging mechanism. >> >> For example, I've modified jboss-logging.xml to use a log4j console appender >> and a log4j file appender instead of the standard appenders (see attached >> file). This did not work. The log file ${jboss.server.log.dir}/log4j.log is >> not created, the console log stays at level INFO (instead of DEBUG). >> >> What would I have to do in order to get JBoss 6 to use log4j for my >> applications? >> One requirement we have is to store the log4j configuration in a central >> file and not within the application packages (because for debugging purposes >> we ask our customers to modify the configuration). >> >> I'm using JBoss 6.1 final, in case that makes a difference. >> >> Thanks a lot >> Piers >> >> -- >> Piers Uso Walter <[email protected]> >> ilink Kommunikationssysteme GmbH >> >> >> <jboss-logging.xml> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
