Fun with Log4J and JBoss
I've had the pleasure of working with JBoss (3.2.5) and an AppFuse-based application for the past week. It was fairly easy to setup thanks to Rick Hightower's instructions. AppFuse uses commons logging (like many of its open-source dependencies), but uses log4j to control what gets printed to where. By default, it changes Hibernate and Spring to use WARN and the application classes to use DEBUG. For most containers, this works great. Drop in the WAR, or package it in an EAR and voila - your logging statements show up in the console. Not so with JBoss. Spring and Hibernate use INFO and I can't get any debug statements to show from my classes.
I shouda known this would be a pain since Rick wrote "Setting up logging is a pain in JBoss. Don't mess with the console log... it misbehaves. Create a file logger and tail it.". Is this the best practice for logging with Log4J in JBoss?
You'd think printing to the console would be easy. This wiki page even makes it look easy: change your log4j.properties to log4j.xml and add a <class-loading> snippet to your jboss-web.xml. Unfortunately, I get this nice error message:
00:21:17,593 WARN [DeploymentInfo] Only the root deployment can set the loader repository, ingoring config=LoaderRepositoryConfig(repositoryName: log4j.config:loader=appfuse.war, repository ClassName: org.jboss.mx.loading.HeirarchicalLoaderRepository3, configParserClassName: org.jboss.mx.l oading.HeirarchicalLoaderRepository3ConfigParser, repositoryConfig: java2ParentDelegation=false)
Any ideas are appreciated - it seems wrong that I have to write to file just to tail it so I get the same console behavior I get with other servers.
Posted by Danny on October 29, 2004 at 08:28 AM MDT #
Posted by Tim on October 29, 2004 at 01:05 PM MDT #
Posted by Scott on October 29, 2004 at 02:14 PM MDT #
Posted by Nathaniel on November 11, 2004 at 07:09 PM MST #
Posted by 12.5.150.254 on April 21, 2005 at 06:54 PM MDT #
Posted by java developer on November 13, 2008 at 03:51 AM MST #
Posted by developer on November 13, 2008 at 03:52 AM MST #