• 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

Unable to set classpath for log4j

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the example from the website Log4J Example

I am having log4j in "C:\apache-log4j-1.2.16" and log4j-1.2.16.jar is in "C:\apache-log4j-1.2.16". I have set the path to C:\apache-log4j-1.2.16\log4j-1.2.16 and LOG4J_HOME="C:\apache-log4j-1.2.16"
When I run the program, I am getting this error:


I am using netbeans and have added the library file to the project. What is going on?


Thanks,
 
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not an error but a warning. Have you followed the steps suggested in the warning (read: do you had a look at the FAQ)?
 
Sree Potluri
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I did read the article. But I gave it the path to the properties file and still I am unable to see the output.
 
Sree Potluri
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have even tried



still getting the same warning and I see no messages
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But

log4j-1.2.16.jar


is not the property file. Usually you name it log4j.properties.
 
Sree Potluri
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


if I give PropertyConfigurator.configure("log4j.properties"); I get fileNotFound error.

 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JAR file and the properties file simply need to be in your CLASSPATH, you should not have to explicitly link to them in your code. Please serach this forum for similar questions as there are several good answers there.
 
reply
    Bookmark Topic Watch Topic
  • New Topic