db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Waggott <ge...@webartjapan.com>
Subject Re: Torque.properties and Logging with Torque 3.1
Date Tue, 13 Apr 2004 07:01:49 GMT
Hi James,

I puzzled over this too for a while. It would seem that the Torque 
documentation is out of date.

Torque 3.1 uses the Jakarta Commons Logging library that acts as a 
common wrapper api around several logging toolkits one of which is log4j.

Place a commons-logging.properties file in your web apps WEB-INF classes 
directory containing the following:

Actually the implementation class name differs between releases of the 
commons-logging library so check that you've specified the right one.

Then configure your log4j.properties file how you want.


James Roycroft wrote:

>In the 3.1 distribution of Torque (runtime), the torque.properties file
>includes entries for logging with Log4J. I have never been able to get these
>to work. I eventually found that Log4J is not reading the file at all. It
>looks for a log4j.properties file in the classpath to use.
>Torque itself has no problem reading the file, and parses the database
>entries I have in there without fail. If I use Torque 3.0.2 with the same
>file, the logging works.
>Here is one of the logging functions I set up to log all Torque messages:
>log4j.category.org.apache.torque = ALL, org.apache.torque
>log4j.appender.org.apache.torque = org.apache.log4j.FileAppender
>log4j.appender.org.apache.torque.file = e:/webcrmtorque.log
>log4j.appender.org.apache.torque.layout = org.apache.log4j.PatternLayout
>log4j.appender.org.apache.torque.layout.conversionPattern = %d [%t] %-5p
>%c - %m%n
>log4j.appender.org.apache.torque.append = false
>This whole setup is running under Tomcat 4.1 with a MySQL 4 backend. I would
>like to know if this behavior in Torque 3.1 is by design, or if I have
>something set up incorrectly in my environment.
>Also, thanks to Rob Guest for his post on "Tips on fixing broken logging
>configurations" which contained some useful information on the same lines.
>Two notes on that:
>- The java.class.path property is not really useful within Tomcat, as it
>resolves to the bootstrap.jar used for launching Tomcat. I believe Tomcat
>does not use the classpath at all, it creates its own. So the important
>thing is to include log4j.properties in the classpath available to your web
>application (WEB-INF\classes will work).
>- The LogFactory class is part of the org.apache.commons.logging package
>which you need to import to use the code snippet for checking the default
>logger you have.
>If I have left something out of my setup that you want to check on, the
>source files and jars for this project are available in the suggested Tomcat
>Web App form at http://www.codesilver.ca/cgi-bin/viewcvs.cgi/webcrm/
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org

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

View raw message