You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Laurie Harper <zo...@holoweb.net> on 2002/12/17 23:53:56 UTC

Logging configuration

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.

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?

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?

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?

If there's any documentation on this (other than the comments in 
Turbine.properties) feel free to point me at it and I can come back with 
any questions it doesn't answer :-)

L.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logging configuration

Posted by Laurie Harper <zo...@holoweb.net>.
Rodney Schneider wrote:

> I'm actually not sure how the TurbineLoggingService maps it's
> properties to Log4J...


OK, I'll have to experiment... :)

> It all works for Turbine 2.2, but TDK 2.2 didn't contain the
> log4j.properties file.


OK

> >Yeah, but how does that translate into Log4j categories? It sounds
> >like the answer is 'directly' -- i.e. I'd use
> >'log4j.category.system=...' in log4j.properties.
> You'll have to read through the source code of the
> TurbineLoggingService... unless someone else knows the answer?


I'll take a look at the log4j.props in TDK 2.2.01 and see if it's 
obvious from that.

L.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logging configuration

Posted by Rodney Schneider <ro...@actf.com.au>.
On Wed, 18 Dec 2002 11:46, you wrote:

> What happens if I don't specify the ...destination.file property?
> That should be configured through the log4j.properties. In fact,
> everything but the className should ideally...

I'm actually not sure how the TurbineLoggingService maps it's 
properties to Log4J...

> > 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.
>
> If I read your posting on the dev list right, there's no code changes
> in 2.2_01, right? I.e. this should all work for 2.2 as well?

It all works for Turbine 2.2, but TDK 2.2 didn't contain the 
log4j.properties file.

> > All Turbine generated logging goes through the "system" and "sql"
> > facilities of the LoggingService configured in
> > TurbineResources.properties.
>
> Yeah, but how does that translate into Log4j categories? It sounds
> like the answer is 'directly' -- i.e. I'd use
> 'log4j.category.system=...' in log4j.properties.

You'll have to read through the source code of the 
TurbineLoggingService... unless someone else knows the answer?

-- Rodney

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logging configuration

Posted by Laurie Harper <zo...@holoweb.net>.
Rodney Schneider wrote:

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


That's what I like to hear :)

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


What happens if I don't specify the ...destination.file property? That 
should be configured through the log4j.properties. In fact, everything 
but the className should ideally...

> 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.


If I read your posting on the dev list right, there's no code changes in 
2.2_01, right? I.e. this should all work for 2.2 as well?

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


Yeah, but how does that translate into Log4j categories? It sounds like 
the answer is 'directly' -- i.e. I'd use 'log4j.category.system=...' in 
log4j.properties.

L.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logging configuration

Posted by Rodney Schneider <ro...@actf.com.au>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>