My log4j is working fine when I run “java pakcage.Main” from command line, but when I run the same program using executable jar like “java -jar myjar.jar” I’m getting the following err:
log4j:WARN No appenders could be found for logger
log4j:WARN Please initialize the log4j system properly
log4j.jar and log4j.properties are threre in my manifest’s Class-Path.
I’m sure it worked properly once, but after rebuild it is not working.
You can only list jar files or directories as part of a classpath. Instead of specifying log4j.properties you should specify the directory that the properties file is in relative to the jar being executed.
Example:
If myjar.jar in the base directory, log4j.jar in ./lib/ and log4j.properties in ./conf/
The Class-Path entry in myjar.jar as follows
Class-Path: lib/log4j.jar conf/