I have a java main application, and I want to use log4j.
I don’t want to hard code my settings, so where do I put the log4j config file so my application can find it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A) in your classpath put a file named log4j.properties
B) Add this to your JVM command line
-Dlog4j.configuration=foobar.txt(The configuration file will be foobar.txt)The exact rules for this are defined in the Log4j documentation in http://logging.apache.org/log4j/1.2/manual.html