You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Folkens, Brad" <bf...@downers.us> on 2004/04/23 17:43:27 UTC

Turbine defaults to SimpleLog

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


RE: Turbine defaults to SimpleLog

Posted by David Wynter <da...@roamware.co.uk>.
Hey Brad,

So to clarify. We undo the changes to Turbine.java you originally suggested
last year and instead apply the simple change below?

I have found this whole thing a total nightmare and have been unable to work
out how to fix the Turbine code. The fact that the Turbine commiters have
not done anything about it also concerns me.

Thanks,

David

-----Original Message-----
From: Folkens, Brad [mailto:bfolkens@downers.us]
Sent: 23 April 2004 16:43
To: 'Turbine Users List'
Subject: Turbine defaults to SimpleLog


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



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Turbine defaults to SimpleLog

Posted by Eric Pugh <ep...@upstate.com>.
For this patch, do you need the commons-logging.properties file?  Could you
maybe update the log4j.properties file in CVS for T2.4 to instead be a
commons-logging.properties file and submit a patch for changing Turbine
against T2.4?

It would be great to get rid some of these deprecation errors!

Eric

> -----Original Message-----
> From: Folkens, Brad [mailto:bfolkens@downers.us]
> Sent: Friday, April 23, 2004 11:43 AM
> To: 'Turbine Users List'
> Subject: Turbine defaults to SimpleLog
>
>
> 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.Log4JLogg
> er
>
> 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.ja
> va,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
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org