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 Shinkan <sh...@gmail.com> on 2008/08/01 09:30:40 UTC

Re: Log4J + Torque ... gonna drive me mad.

Hi everyone !

By the way thank you very much everyone involved for clarifying this so
> much.


Thanks you very much as well, this have been really helpful considering the
lack of examples for this situation on the Web.



>
> I have a different opinion about this. Torque does neither initialize
> log4j nor commons-logging. It is up to the user to do this. If you don't
> initialize logging, the standard configuration is used. This is the
> intended behaviour.
>

I agree with that.
But as it's Torque (or commons-logging) which OUTPUT the log messages on the
classes and packages it wants, it should ensure that something could be done
with the Log4j configuration, or guess, or whatever, or at least the Torque
website should have a FAQ which says that this package and this package MUST
have appenders configured, because we're not supposed to know who outputs !!

Then, to conclude, TO HAVE TORQUE LOG WORKING :

- Just put a log4j.properties in your classpath, saying that :
log4j.category.rootCategory = <whatever>
log4j.category.org.apache.commons = <whatever>
log4j.category.org.apache.torque = <whatever>
<rest of config files>

- Put a commons-logging.properties in your classpath with these 2 lines :
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

You need commons-logging and log4j jars (and probably other dependencies) to
make this working, of course.

That's it !
Thanks again everyone !


-- 
Pierre.
With some more efforts, maybe one day Human beings could win against library
configuration :p

Re: Log4J + Torque ... gonna drive me mad.

Posted by Thomas Fischer <fi...@seitenbau.net>.
> I agree with that.
> But as it's Torque (or commons-logging) which OUTPUT the log messages on 
the
> classes and packages it wants, it should ensure that something could be 
done
> with the Log4j configuration, or guess, or whatever, or at least the 
Torque
> website should have a FAQ which says that this package and this package 
MUST
> have appenders configured, because we're not supposed to know who 
outputs !!

I agree it should be documented what to do. But I still am convinced that 
no library should attempt to configure the logger. Imagine you have some 
twenty libraries and each does some initialisation by guess ...a 
nightmare.
 
> Then, to conclude, TO HAVE TORQUE LOG WORKING :
> 
> - Just put a log4j.properties in your classpath, saying that :
> log4j.category.rootCategory = <whatever>
> log4j.category.org.apache.commons = <whatever>
> log4j.category.org.apache.torque = <whatever>
> <rest of config files>
> 
> - Put a commons-logging.properties in your classpath with these 2 lines 
:
> 
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
> 
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
> 
> You need commons-logging and log4j jars (and probably other 
dependencies) to
> make this working, of course.

Thanks a lot, I'll ad that to the documentation.

    Thomas