I just started using Log4J for the first time. I created the log4j.properties file and placed it in the project folder in Eclipse. I also created a launch configuration for my application (this is just the default launch configuration, no additional options).
Now I try to start the application, and I get an error when log4j cannot initialize itself (read the properties file). I know that the properties file must be in the class path, so itโs obvious that Run Run does not set the class path correctly.
If I go to the Classpath tab of my startup configuration, I have the following:
- Bootstrap Entries
- User posts
- MyApplication (default path)
- log4j-1.2.15.jar - C: \ Workspace \ MyApplication \ lib
However, if I add the project folder manually (I click Add Folders, Advanced, MyApplication), log4j will be able to initialize itself.
Why is this so? Why can't log4j find the properties file unless I manually add the project folder? Isn't this the default classpath folder? (The above conclusion suggests that this is so.)
source share