• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding property file in Eclipse java project

 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, you should put the log4j.properties file under project directory, not under src directory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic