Using Log4j with JBoss 6
To be honest I'm not a big fan of the release 6 of the application server. One of the major complaints is the logging area, which departed from log4j and switched to a native logging implementation which is however poorly documented. In this short tutorial we will show how to use log4j on JBoss AS 6 to produce custom application logging.
In order to configure your application to use log4j on JBoss 6 you have to follow this schema:
Place log4j.xml file in a place which is visible to the application class-path. In a Web application for example, place the log4j.xml file into the "src" folder so that it will be moved into the WEB-INF/classes of your Web application.
The following file configures two appenders, a CONSOLE appender and a FILE appender which rolls logs into ${jboss.server.home.dir}/log/application.log:
Place log4j.jar library into the WEB-INF/lib (or into the EAR's "lib" folder). This step is essential otherwise JBoss 6 will revert to its native logging implementation.
This is a sample Eclipse Project view which uses log4j:


