views:

310

answers:

1

I have a simple EJB jar with a stateless session bean, deployed in JBOSS AS 4.2.2, under <JBOSS_HOME>/server/default/deploy. The bean is registered under JNDI tree as viewed from jboss jmx console and I am able to access it through a remote java client outside JBOSS.

Inside EJB jar, I have added some logging to be written to a separate log file, using apache log4j jar and log4j.xml. But I am not able to view any of the logs.

Also I do not wish to use jboss-log4j.xml, since there will be many other EJBs to be deployed and wish to have separate log4j for each EJB application.

Here is my one of the EJB-jar contents:

EJB_DS.jar: log4j.xml classes

apache log4j jar is added to <JBOSS_HOME>/server/default/lib path.

Kindly highlight if i have missed any points for enabling log4j configuration

+2  A: 

This isn't an option in JBoss, unfortunately. The entire server operates off a single log4j configuration (specified by conf/jboss-log4j.xml), and your EJBs cannot change that. It's not ideal, but that's the way it is.

Also, you don't need to add log4j.jar to server/default/lib, JBoss already has its own internal copy.

skaffman
ok ..i thought there will be a way override default jboss log4j. Thanks for your advice.
@user309281: You could experiment with a non-log4j solution inside the EJB, such as sfl4j+logback. If you do it right, this should not interfere with log4j, allowing you to do what you want.
skaffman