I have a jar file with the following Manifest
Manifest-Version: 1.0
Created-By: 1.7.0_07 (Oracle Corporation)
Main-Class: test.Main
Class-Path: ./log4j.properties lib/log4j-1.2.17.jar
I run the class as follows
java -jar test.jar
And this is my folder
lib
log4j.properties
test.jar
Why I can't see the log4j properties file? This is what I see
log4j:WARN No appenders could be found for logger (test.Main).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Thank you
SOLUTION: changed my classhpath in the MANIFEST to this
Class-Path: . lib/log4j-1.2.17.jar
You can also start your JVM with argument:
-Dlog4j.configuration=file:"./your/properties/path/log4j.properties"
to specify arbitrary location of your external log properties. I used this a lot in one particular project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With