File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4j not working in EJB project

 
Hitesh Guna
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an EAR project.
I have two separate schedulers running in it and i want to direct the logs of the schedulers in 2 different log files.
i have placed the log4j.properties file in the resources folder.

But the logs are not being directed to the log files.

Following is my log4j.properties file.



Any idea???
 
Hitesh Guna
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any Help???
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hitesh,
Welcome to the Ranch!

Firs of all, is any logging file created at all? Your log4j configuration looks complex to me. I think you should start with a simple one and then build on it.
 
Hitesh Guna
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranganathan,

Thanks for your reply...

I am getting a feeling that the configuration file is not being read...

because i have used the same configuration file in other project...and it created proper log files...

Right now...the project is using EJB3.0 & is being deployed on JBOSS 5.1...

I have tried the same code using EJB3.1 & JBOSS 6...Here i added extra class with @Startup annotation at the class level & @PostConstruct at the method level. Inside this method i had loaded the configuration...

Now the problem is, there is nothing like @Startup in EJB3 ,& EJB3.1 is not supported by JBOSS 5.1...So i cant add such startup code...

And by default right now the logs are being redirected to server.log...But i want the log for the two schedulers to go in different log files...can you suggest anything???
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. You can try having a ServletContextListener and do this config setup there. If config setup has to be done only in EJB, then you can invoke that EJB call inside this servlet context listener call. But, you will have to add a war to the ear in this case. This may not be the best solution though...
 
Hitesh Guna
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok...That can be a nice workaround...
But still...any other ideas???
N Thanks for your prompt reply...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic