GeeCON Prague 2014*
The moose likes Other Open Source Projects and the fly likes Unable to set classpath for log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Unable to set classpath for log4j" Watch "Unable to set classpath for log4j" New topic
Author

Unable to set classpath for log4j

Sree Potluri
Ranch Hand

Joined: Aug 12, 2009
Posts: 62
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,
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

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

Joined: Aug 12, 2009
Posts: 62
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

Joined: Aug 12, 2009
Posts: 62
I have even tried



still getting the same warning and I see no messages
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

But
log4j-1.2.16.jar

is not the property file. Usually you name it log4j.properties.
Sree Potluri
Ranch Hand

Joined: Aug 12, 2009
Posts: 62


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

Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

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.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
GeeCON Prague 2014
 
subject: Unable to set classpath for log4j