A non-JBoss log4j Instance
twhphan Jan 23, 2002 1:45 PMHi,
I'm using JBoss 3 RH (CVS), and an external Calatina 4.0.1
I want my application (EAR) to use log4j, but I don't want to use the log4j instance that JBoss uses.
I've WEB-INF/lib/log4j.jar my WAR file. Since I use an external Tomcat, log4j executes in a different JVM than JBoss, and it gives the expected output for the web part.
For the EJB part, I'm not sure which log4j instance my application is using (maybe they are using the same static instance). If JBoss doesn't use log4j, I should write a MBean that calls org.apache.log4j.PropertyConfigurator.configure().
Since JBoss uses log4j, where should I set log4j.properties for my application? I set:
log4j.rootCategory=DEBUG, Console, Jms
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Jms=org.apache.log4j.net.JMSAppender
log4j.appender.Jms.TopicConnectionFactoryBindingName=java:/ConnectionFactory
log4j.appender.Jms.TopicBindingName=topic/logger
log4j.category.esb=DEBUG
in my WAR file, and it works fine (both to the console locally, and to the JMS/MDB running on the JBoss JVM). Is it possible to use a different log4j.properties file for my application than the one JBoss is using? I want to make my application to have an option to deploy in a non-JBoss application server.
Also, in my JBoss console, I've more messages than I expected to see (they appear only in log/server.log before). How may I fix this?
01:50:50,479 INFO [Default] 30705 [AutoDeployer] INFO org.jboss.deployment.J2eeDeployer#Default - Deployed J2EE application: file:/var/jboss-all/build/output/jboss-3.0.0alpha/deploy/esb.ear
01:50:56,171 INFO [Default] 36398 [RMI TCP Connection(6)-] DEBUG org.jboss.ejb.EntityContainer - METHOD HOME INVOKE jboss.j2ee:service=EJB,jndiName=ejb/User||findByPrimaryKey||[Ljava.lang.Object;@25e68a
01:50:56,223 INFO [Default] 36450 [RMI TCP Connection(6)-] DEBUG org.jboss.tm.TxCapsule User - Created new instance for tx=XidImpl [FormatId=257, GlobalId=//0, BranchQual=]
01:50:56,224 INFO [Default] 36451 [RMI TCP Connection(6)-] DEBUG org.jboss.tm.TxManager User - began tx: TransactionImpl:XidImpl [FormatId=257, GlobalId=//0, BranchQual=]
01:50:56,331 INFO [Default] 36558 [RMI TCP Connection(6)-] DEBUG org.jboss.tm.TxCapsule User - registerSynchronization(): Entered, tx=XidImpl [FormatId=257, GlobalId=//0, BranchQual=] status=STATUS_ACTIVE
01:50:56,332 INFO [Default] 36559 [RMI TCP Connection(6)-] DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.User.findByPrimaryKey User - Executing SQL: SELECT ... FROM User WHERE username=?
01:50:56,363 INFO [Default] 36589 [RMI TCP Connection(6)-] DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.User.findByPrimaryKey User - Set parameter: index=1, jdbcType=VARCHAR, value=twhphan
...
02:00:37,135 INFO [Default] 617362 [Minerva ObjectPool GC Thread] DEBUG org.jboss.pool.PoolGCThread - gc thread delay: 599999
02:04:06,582 INFO [Default] 826809 [TimerTask Thread] DEBUG org.jboss.ejb.plugins.EnterpriseContextCachePolicy - Scheduling for passivation overaged bean User with id = [.twhphan.] - Cache size = 1
02:04:06,583 INFO [Default] 826810 [TimerTask Thread] DEBUG org.jboss.ejb.plugins.EnterpriseContextCachePolicy - Aging out from cache bean Userwith id = [.twhphan.]; cache size = 1
For above, it's possible that the JBoss JVM reads my log4j.properties file, as Jetty deploys my WAR file (as JBoss deploys my EAR file) as well