I have written an runnable java application(command line application).
I put the log4j.xml
in src/main/resources
,and when I debug the application in eclipse, it works well.
But when I export it to an runnable jar file(exclude all required libraries and resources), and run it in command line.
java -jar myapp.jar
, the application cann't find the log4j.xml
.
the warning is:
log4j:WARN No appenders could be found for logger.
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
And when I put the log4j.xml
to the folder where to put the myapp.jar
, it works again!
How can I use the log4j.xml
packaged in the myapp.jar
?