• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic