Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4j not working as expected with ejb module

 
Arun Merum
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you get hold of the logger in your EJBs? Post that piece of code (including the package declaration).
 
Arun Merum
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


is what I use in the EJB to get the logger. Thanks for the quick reply.

Regards
Arun
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EJB code


and the servlet code


Thank you.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic