Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Log4j not working in EJB project

 
Greenhorn
Posts: 4
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any Help???
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • 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
  • 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: 1104
10
Netbeans IDE Java Ubuntu
  • 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
  • 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...
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic