Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Unable to set classpath for log4j  RSS feed

 
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,
 
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.

 
author
Posts: 3281
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
Boost this thread!