This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't find logj4.properties using netbeans, hibernate and glassfish

 
Alvaro Reinoso
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm getting this error when I run my web application using netbeans and glassfish:



I really need to debug the hibernate queries. Log4j.properties file is configured, but it seems my app can't find it.

This the class where I initialize the logger:



I want to store logj4.properties in cfg folder. Even if I try PropertyConfigurator.configure("logj4.properties") (also hardcoding the path) and put the file in src folder, it can't find.

Any help would be really useful.

Thanks!
 
Paul Clapham
Sheriff
Pie
Posts: 20771
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The normal way to configure log4j is to put the log4j.properties file in the classpath. That's all you need to do... unless you are trying to configure something which isn't in the properties file. Your code doesn't do anything like that, so you should remove it entirely.

As for putting it into the classpath, your Netbeans cfg directory definitely isn't going to be the right place. In real life your Glassfish server won't care about Netbeans at all, or even know about it. I try to arrange things so that my log4j.properties file gets put into the web application's /WEB-INF/classes directory. I assume Netbeans can arrange that for you but (not being a Netbeans user) I can't tell you how.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic