| Author |
Log4j not working as expected with ejb module
|
Arun Merum
Greenhorn
Joined: Aug 31, 2010
Posts: 7
|
|
Hi, I have an EAR project where in I have to log all my servlet logs and EJB logs to two different files. I have a log4j.xml file packaged in the root directory of the .ear file. In other words the .ear file contains log4j.xml, log4j.jar, webModule.war and ejbModule.jar file. While the servlet log are getting logged as expected with the below log4j.xml file, EJB logs are completely being omittied from getiing logged to the firstEJB.log file.
If I add both the appenders to the <root> catagory the servlet logs get logged to firstS.log twice and once to firstE.log again missing the EJB logs altogether. I am not using any log managers in my code. Is it some initialization problem with the ejbMOdule or someing like that? Please help me in this regard. Thanks in advance.
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8146
|
|
|
How do you get hold of the logger in your EJBs? Post that piece of code (including the package declaration).
|
[My Blog] [JavaRanch Journal]
|
 |
Arun Merum
Greenhorn
Joined: Aug 31, 2010
Posts: 7
|
|
Hi,
is what I use in the EJB to get the logger. Thanks for the quick reply.
Regards
Arun
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8146
|
|
Like I said in my previous reply :
Jaikiran Pai wrote: Post that piece of code (including the package declaration).
Which package does FirstSessionBean class belong?
|
 |
Arun Merum
Greenhorn
Joined: Aug 31, 2010
Posts: 7
|
|
The EJB code
and the servlet code
Thank you.
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8146
|
|
Based on what you have posted I don't see anything wrong with the code or the config. I would expect the logs from the bean to be logged to the firstE.log and firstS.log files, assuming the bean method is being called.
|
 |
 |
|
|
subject: Log4j not working as expected with ejb module
|
|
|