I\'m having some problems putting my log4j.properties file on classpath. I can use it when I\'m developing (Eclipse Indigo) but, when I export my app as a JAR, I can\'t.
try to execute:
javar -jar -Dlog4j.configuration=file:"./log4j.properties" app.jar
There are three ways l know.
log4j.properties
to app.jar
log4j.properties
to the "folder" (where the JAR exists) and change the class-path to .lib/log4j-1.2.15.jar
.log4j.properties
to the folder named "conf" for example, and change the class-path to ./conf/
.I have tried, it works.
Do not put the log4j.properties
itself in the classpath, but the directory that contains that file.
Class-Path: lib lib/log4j-1.2.15.jar
one more way to do this:
-Dlog4j.configuration=file:"./log4j.properties"
Add log4j.properties
to app.jar
.
I tried the answer of Jesper, and at first it didn't work. Then I tried with
Class-Path: lib/ lib/log4j-1.2.15.jar
And it worked after that.