You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Martin Lidgard <ma...@arkatay.com> on 2007/02/06 10:56:33 UTC

SV: Turbine 2.3.0/Commons-Logging configuration under Tomcat 5.5

Hi all,

many thanks to David, Juergen and Thomas for their input in December (!).
Your comments assured me that I needed to look somewhere deeper to find the
root of this problem.

The problem seems to stem from Turbine.java in Turbine 2.3.0 where the
configure() method explicitly requires
org.apache.commons.logging.impl.Log4jFactory from commons-logging-1.0.x.jar.
Log4jFactory has been removed from commons-logging-1.1 and from what I can
understand, Tomcat 5.5 requires commons-logging-1.1. This caused a conflict
that I was unable to resolve with configuration tools only. 
My only option was to upgrade from Tomcat 2.3.0 to Tomcat 2.3.2 which, as
noted in the release history
http://jakarta.apache.org/turbine/turbine/turbine-2.3.2/changes-report.html:
>>>>>>>>>>>>>>>>
Turbine no longer configures the logging factory for commons-logging
explicitly. If you relied on this behaviour, you must add a
commons-logging.properties file to your application as described in the
commons logging documentation 
<<<<<<<<<<<<<<<<

The upgrade was painless (thus far...) requiring only that the
turbine-2.3.2.jar and all of its dependencies
(http://jakarta.apache.org/turbine/turbine/turbine-2.3.2/dependencies.html)
replaced their counterparts from Turbine 2.3.0.
The only glitch was that WEB-INF/build/build.properties had to be adjusted
by ensuring that the following properties were correctly set (they were
previously commented out):
torque.database.buildUrl = jdbc:mysql://localhost:3306/myapp
torque.database.driver = com.mysql.jdbc.Driver
torque.database.user = myappuser
torque.database.password = myapppassword

Note that since the upgrade from MySQL 4.0.x to 5.0.x, I had to replace
mm-mysql-2.0.13-bin.jar with mysql-connector-java-5.0.4-bin.jar which has
the org.gjt.mm.mysql.Driver only as a dummy extension of
com.mysql.jdbc.Driver for backwards compatability. Thus the change in
database.driver above.

For the moment, the documented
(http://tomcat.apache.org/tomcat-5.5-doc/logging.html) default log4j
configuration seems to work for me. The
tomcat5.5/common/classes/log4j.properties file reads:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
log4j.rootLogger=ERROR, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
log4j.logger.org.apache.catalina=ERROR, R
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
This seems to work fine when I have commons-logging-1.1.jar and
log4j-1.2.14.jar in tomcat5.5/common/lib, which means that they are not
needed in myapp/WEB-INF/lib.

Please let me know if there are any issues that any of you have experienced
when going from Turbine 2.3.0 to Turbine 2.3.2.

Thanks for all the help!

/Martin



-----Ursprungligt meddelande-----
Från: David Demner [mailto:turbine2@demner.com] 
Skickat: den 9 december 2006 04:01
Till: 'Turbine Users List'
Ämne: RE: Turbine 2.3.0/Commons-Logging configuration under Tomcat 5.5

Martin,

I've also found that rogue log4j jar files (in WEB-INF/lib, or tomcat's
common/lib, server/lib, or shared/lib) can cause this double initialization.

Good luck,

David

-----Original Message-----
From: Martin Lidgard [mailto:martin@arkatay.com]
Sent: December 8, 2006 1:04 AM
To: 'Turbine Users List'
Subject: Turbine 2.3.0/Commons-Logging configuration under Tomcat 5.5

Hello,
 
I am working on upgrading our hosting environment from Tomcat 4.1 to Tomcat
5.5. In our current Tomcat 4.1 environment we are running Turbine 2.3
(2.3.0, not 2.3.2) with commons-logging-1.0.4 and log4j-1.2.8 using more or
less the default logging configuration from Turbine.  When upgrading to
Tomcat 5.5 the logging does not work as intended.
 
Logging is written to the webapp's local log as expected during startup,
with logging level DEBUG for the log4j.logger.myapp entry:
myapp.log (22817 bytes)
scheduler.log (127 bytes)
torque.log (0 bytes)
turbine.log (0 bytes)
velocity.log (0 bytes)
 
Initialization logging is written to /var/log/tomcat/catalina.out, showing
among other things an init of Log4j:
[...]
log4j: Parsing for [root] with value=[DEBUG, console, myapp].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "console".
log4j: Parsing layout options for "console".
log4j: Setting property [conversionPattern] to [%-5r %-5p %-25.25c{1} -
%m%n].
log4j: End of parsing for "console".
log4j: Setting property [threshold] to [DEBUG].
log4j: Parsed "console" options.
log4j: Parsing appender named "myapp".
log4j: Parsing layout options for "myapp".
log4j: Setting property [conversionPattern] to [%d %-5p %c{1} - %m%n].
log4j: End of parsing for "myapp".
log4j: Setting property [append] to [true].
log4j: Setting property [file] to
[/usr/local/tomcat/webapps/myapp//logs/myapp.log].
log4j: Setting property [threshold] to [DEBUG].
log4j: setFile called: /usr/local/tomcat/webapps/myapp//logs/myapp.log, true
log4j: setFile ended
log4j: Parsed "myapp" options.
[...]
 
After a number of lines of log messages in catalina.out describing
initialization of Turbine services, there seems to be a second Log4j
initialization using the same configuration as above.
After this, debug messages that are specific to the initialization of
"myapp" are written to both catalina.out and webapps/myapp/logs/myapp.log,
as expected.
 
However, when performing the first request to the servlet, no further debug
logging is written to either catalina.out or myapp.log. Only INFO-level
logging is written to catalina.out describing the late initialization of the
Turbine services.
 
Is Log4j reconfigured somehow during the request without telling? Could
there be a link missing between Tomcat's request and the logging? Any ideas
or sample configurations would be greatly appreciated.
 
Thanks,
 
Martin


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



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



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