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/
I believe you should also be able to simply include your log4j.xml (or log4j.properties) file inside of your custom Jar file. As long as it is in the root of your Jar file, the log4j framework will be able to find it.
Does this help ?
http://marc.info/?l=log4j-user&m=105168892203831&w=3