Get your CodeRanch badge!*
The moose likes Other Open Source Projects and the fly likes Log4j not working as expected with ejb module Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j not working as expected with ejb module" Watch "Log4j not working as expected with ejb module" New topic
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: 9317
    
109

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: 9317
    
109

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: 9317
    
109

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Log4j not working as expected with ejb module
 
Similar Threads
how to debug log4j
Avoid additional server.log debug lines
struts 2 and log4j
How to monitor log file in jboss for sending mails,when error or excetion found in log
Log4j : specific class to log on FileAppender other classes log on Console Appender.