File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes adding property file in Eclipse java project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "adding property file in Eclipse java project" Watch "adding property file in Eclipse java project" New topic
Author

adding property file in Eclipse java project

naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384


hi ranchers ,

i am using Eclipse for creating java project used for logging the events

i have placed the log4j.properties file manually inside the src folder but when i run i get this with desired output


log4j:ERROR Could not read configuration file [log4j.properties].
java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.io.FileInputStream.<init>(FileInputStream.java:79)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:372)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:403)
at com.MyLogger.main(MyLogger.java:25)
log4j:ERROR Ignoring configuration file [log4j.properties].


/* desired output
0 [main] WARN com.MyLogger - Sample warn message
0 [main] ERROR com.MyLogger - Sample error message
0 [main] FATAL com.MyLogger - Sample fatal message

*/

why it shows error message ?
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Hi, you should put the log4j.properties file under project directory, not under src directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding property file in Eclipse java project
 
Similar Threads
log4j propery configuration problem
log4j:ERROR Could not read configuration file
In Eclipse, how to add log4j.properties to classpath ?
log4j configuration error
log4j error?