If you are having trouble working out which log4j.properties file is being used then use this:
-Dlog4j.debug
for more info click here
Please remember that log4j will load in the properties files in CLASSPATH order.
To force your code to use a specific log file use this:
-Dlog4j.configuration=file:C:\temp\log4j.xml
or
-Dlog4j.properties=file:C:\temp\log4j.properties
Sample log4j.properties files:
click here
If you want to change what is written to the logs [dates / classname etc]:
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
sample log4j.xml file:
http://www.google.com/codesearch/p?hl=en#3hqpXVqVs-0/trunk/restlet/log4j.xml&q=log4j%20lang:xml&sa=N&cd=6&ct=rc
No comments:
Post a Comment