• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging question : Where should I put the log4j jar file?

 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am trying to use log4j for the first time and have been reading all kinds of tutorials online on the subject. Unfortunately I have hit a wall and could use some help.
I have created the following log4j.properties file




I have put code into my java application to write log messages, but I don't even get to the code, I get an error on the startup of tomcat. Could this be because I do not have my log4j jar file in the correct place?
Here is the error message:

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I put mine under myWebapp/WEB-INF/lib
I put the properties file under myWebapp/WEB-INF/classes

Works like a charm.
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However you'll want to get correct data in your configuration. For example this line
log4j.appender.KimAppender=RollingFileAppender
should spell out the full class name of RollingFileAppender, which (I'm not going to look it up) is something like org.apache.something.RollingFileAppender.

The good news is that the error message
java.lang.ClassNotFoundException: RollingFileAppender
implicates that line as being wrong, so that tells us that your properties file is being found successfully.
[ September 20, 2006: Message edited by: Paul Clapham ]
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't thank you enough for your responses! This was driving me crazy!

I added org.apache.log4j.RollingFileAppender where I just had RollingFileAppender and I got past that error. Now I am hitting another error but I think it is the same problem, I need to work some more on my log4j.properties file.

Thanks for helping me over that bump, will let you know if I can get past all the errors and to an actual log file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic