You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by James Roycroft <ja...@telus.net> on 2004/04/10 21:18:43 UTC

Torque.properties and Logging with Torque 3.1

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/

Jim


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


Setting up starting id for native idgenerator.

Posted by sk...@engr.uky.edu.
Hi,

  How do I set up the native id-generator to start the id numbers from a 
particular number? I don't see any attribute in project-schema.xml to do that.
Has someone done this before? I remember seeing a somewhat similar question in
the recent past, but no one replied :(

~Sarav.

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


Re: Torque.properties and Logging with Torque 3.1

Posted by Geoff Waggott <ge...@webartjapan.com>.
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:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog

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.

Cheers,
Geoff

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/
>
>Jim
>
>
>---------------------------------------------------------------------
>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