You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Noel J. Bergman" <no...@devtech.com> on 2004/05/27 15:58:29 UTC

RE: DBCP Contribution: Replace System.out calls with Commons Logging

Craig R. McClanahan wrote:
> Noel J. Bergman wrote:
>>> The upcoming version 1.0.4 of commons-logging has an AvalonLogger
>> So we create an AvalonLogger around our component's logger, and pass
>> that to any object that uses commons-logging.
> I'm travelling and away from my CVS sources for [logging], but I'm
> pretty sure that the 1.0.4 code even auto-recognizes the availability
> of the Avalon logger like it does Log4J and JDK 1.4 logging.  If it
> doesn't, I'd be happy to implement that before a [logging] 1.0.4 release.

Craig, how does that work?  By that, I mean, Avalon uses an IoC model, so
how does the Commons Logger know which logger to use?  For example, I would
want DBCP to be using the logger defined for the database connection
component.  At present, we create an adapter between what DBCP expects
(PrintWriter) and the Avalon logger, but I'd very much like to see
full-fledged logging with levels.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: DBCP Contribution: Replace System.out calls with Commons Logging

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 27 May 2004, at 14:58, Noel J. Bergman wrote:
> Craig R. McClanahan wrote:
>> Noel J. Bergman wrote:
>>>> The upcoming version 1.0.4 of commons-logging has an AvalonLogger
>>> So we create an AvalonLogger around our component's logger, and pass
>>> that to any object that uses commons-logging.
>> I'm travelling and away from my CVS sources for [logging], but I'm
>> pretty sure that the 1.0.4 code even auto-recognizes the availability
>> of the Avalon logger like it does Log4J and JDK 1.4 logging.  If it
>> doesn't, I'd be happy to implement that before a [logging] 1.0.4 
>> release.
>
> Craig, how does that work?  By that, I mean, Avalon uses an IoC model, 
> so
> how does the Commons Logger know which logger to use?  For example, I 
> would
> want DBCP to be using the logger defined for the database connection
> component.  At present, we create an adapter between what DBCP expects
> (PrintWriter) and the Avalon logger, but I'd very much like to see
> full-fledged logging with levels.

hi noel

the current avalon logger implementation allows a default logger to be 
set by a static method call. the implementation then gets a child 
logger (by name) from that logger.

i was looking at this a little while ago and thinking to myself: this 
isn't too clever. at the very least, it should allow default loggers to 
be set per context classloader (to provide isolation in a container 
environment). i may refactor the logger (once the 1.0.4 release is 
done).

a while ago, leo was talking about IoC and logging. he points was that 
it's not really the design of the commons-logging API but the use of 
that API that allows it to be used (or not) in an IoC environment. the 
key is that it should be possible to set the log implementations used 
by the component.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org