On Wed, 18 Dec 2002 09:53, you wrote:
> OK, before I start: I know logging has been a contentious issue
> lately; I'm not interested in where Turbine is or should be going in
> the future, just in what I can do with it today ;-) I'm using Turbine
> 2.2 release.
>
> My objective it to unify, as far as possible, all logging from my
> application. Ideally I'd like to get it all routed through Log4J, use
> a single configuration file to control logging for all components,
> and write all log output to a single common file.

I am pretty sure you should be able to do this...

> So, questions:
>
> 1) can I configure Turbine to use Log4J for all logging? If so, how
> do I do that? Just change all the services.LoggingService.*.className
> entries in Turbine.properties to
> o.a.t.services.logging.Log4JavaLogger?

Yeah, that should do the trick.  The only facility you will need is 
"system".  If you want the SQL statements logged, you can also enable 
the "sql" facility, but I would recommend P6Spy for this.  My settings 
for this (I use log rotation) are:
--------------
services.LoggingService.system.destination.file=/logs/turbine.log
services.LoggingService.system.file.size=1048576
services.LoggingService.system.file.backups=5
services.LoggingService.system.className=org.apache.turbine.services.logging.Log4JavaLogger
services.LoggingService.system.level=DEBUG
--------------

> 2) how do I defer all further logging configuration to a central
> log4j.properties config file? Can I set
> services.LoggingService.loggingConfig to a file name, or to null so
> Turbine wont do any logging configuration itself?

Torque, Fulcrum and the ComponentService are all configured from a 
log4j.properties file.  You will find this in the latest TDK release 
(tdk-2.2_01.tar.gz) or see Scarab issue TDKS11.

How you do logging in your application is up to you.  You can either 
import org.apache.turbine.util.Log and use it for logging (which will 
use the facilities you define in TurbineResources.properties) or you 
can use log4j categories by instantiating the category in your class 
and configuring it in log4j.properties...
--------
private static Category category =
   Category.getInstance(MyClass.class.getName());
--------
... or you can use commons-logging or whatever.

> 3) once everything is going through Log4J how do I control Turbine
> generated logging from the generic log4j.properties file? I know how
> Log4J works, just not how Turbine would be using it. Does Turbine use
> class names as logging categories? Or would I have to filter based on
> the facility names in Turbine.properties?

All Turbine generated logging goes through the "system" and "sql" 
facilities of the LoggingService configured in 
TurbineResources.properties.

Regards,

-- Rodney

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to