To all who are having problems with the default SimpleLog in
commons-logging:
Instead of the hack I mentioned a few months ago (I have since messed around
with this a lot more), the following works more reliably.
1) Make sure you have the latest commons-logging.jar in your /WEB-INF/lib
directory. (Actually, if you're having the problem in the first place then
you probably <do> have the latest commons-logging.jar)
2) Create a commons-logging.properties file in your /WEB-INF/conf directory
that reads:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
3) Copy the commons-logging.properties file to your /WEB-INF/classes
directory (this can be put into ant to copy automagically)
(optional 4) Patch the Turbine.java file with the following (this removes
Log deprecation warnings):
Index: Turbine.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java,v
retrieving revision 1.45
diff -u -r1.45 Turbine.java
--- Turbine.java 2 Jul 2003 16:52:24 -0000 1.45
+++ Turbine.java 23 Apr 2004 15:39:35 -0000
@@ -77,7 +77,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.Log4jFactory;
+import org.apache.commons.logging.impl.Log4JLogger;
import org.apache.log4j.PropertyConfigurator;
@@ -266,8 +266,8 @@
//
// Set up Commons Logging to use the Log4J Logging
//
- System.getProperties().setProperty(LogFactory.class.getName(),
- Log4jFactory.class.getName());
+ System.getProperties().setProperty(Log.class.getName(),
+ Log4JLogger.class.getName());
// Set the application root. This defaults to the webapp
// context if not otherwise set. This is to allow 2.1 apps