This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes log4j propery configuration problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "log4j propery configuration problem" Watch "log4j propery configuration problem" New topic
Author

log4j propery configuration problem

Abhilash Chander
Ranch Hand

Joined: Oct 18, 2009
Posts: 39
Hi, I am using Log4j for my applications logging. I need assitance for two of my problems.

1. I keep getting the following errors on the console


My log4j.properties file is located in the default source package and here is the code.


And is here is the code of my class using it

All my logging is working fine but I dont know why I am still getting these messages.


2. Secondly, this messages keeps printing on the console like 100 times in a single request

I tried to stop that logging by setting the level of my root logger to WARN and created my own logger 'com' for debug logging and set it at the top of the level heiarchy. But I am unable to stop it. Is there any other way to avoid this message from printing because its hard to find the log mesages I printed from my code.

Thanks in advance for your time.



a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
Hi Mr. Chan,

I think you need to specify absolute path for you log4j.properties file. It should be something like this:

PropertyConfigurator.configure("C:\\WORKSPACE\\PROJECT\\web\\WEB-INF\\log4j.properties");

I hope this works

regards,
kishore
Kristof Camelbeke
Ranch Hand

Joined: Nov 28, 2001
Posts: 97
is your log4j file added in the classpath?
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
Hey.... For which version of Struts you are using?

The below info is for Struts 2
1) I had placed my log4j.properties file in src folder.
2) In web.xml include this code
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: log4j propery configuration problem
 
Similar Threads
Log4j appender,stdout Error
Jar hell concerning log4j
log4j configuration error
log4j error?
Confusion in using Log4j