Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to set classpath for log4j

 
Sree Potluri
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • 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,
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator


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

 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic