I have added log4j into my java project.when i run the project log file is created and i can see log detail in created log file. but when i create jar file and run it log file is not created. Please give me some valuable idea.
Thanks in Advance
Software Engineer(BSC):SCJP 1.5
(Knowledge is power when applied)
when i run on command prompt its give following error. but when i run project with eclipes log is created.
log4j:ERROR Could not read configuration file [log4j.properties].
java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)
give me idea why is this probleam
Joined: Nov 28, 2009
Seems like a class path issue. When not configured explicitly, log4j.properties file is picked from default package. Make sure that your log4j.properties file is present at correct location.
For proper location
One simple trick:
Add a file creation code snippet in your project (give only file name without path). Check the location where your new file is getting created. Add your log4j.properties file at that location and try.