Monday, 4 February 2013

JBoss 7 logging tips


To fully embrace jboss 7, use the jboss logging mechanism to specify categories and handlers.  It's not the easiest thing to get working, so I've put together a few hints and tips.

1) Use slf4j-api.jar as the logging facade.  Update the dependencies in the pom.xml to exclude everything else.

Be thorough as the slightest presence of log4j or any other logger, overrides the jboss logging mechanism.  In practice the easiest way is to do this it to use Eclipse to view the pom.xml "Dependency Hierarchy" and exclude any other loggers.   

2) Make sure log4j.properties is not on the classpath of the deployment.  Jboss uses log4j.properties by default - I don't know why!

3) Once and handler has been added, restart the server.

4) If logging is still not working, add the following system property:
org.jboss.as.logging.per-deployment=false



1 comment: