You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Viens, Steve" <St...@FMR.COM> on 2004/04/19 19:46:17 UTC

DBCP Contribution: Replace System.out calls with Commons Logging

-- Reposting with a more descriptive subject --

I've been looking through the DBCP source this morning and have noticed
several instances where System.out, System.err and printStackTrace()
have been used to write error or status messages to the console.

I'm wondering if there's any interest in a contribution that would
replace these calls with calls to the commons-logging package instead?
I'm making these changes to my own copy anyway - so I'm just curious if
there's any interested in having them contributed back. The downside is
that this would make DBCP dependent on the commons-logging library which
(IMHO) is worth it I think. 

Steve (sviens@apache.org)

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

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


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

Posted by "Noel J. Bergman" <no...@devtech.com>.
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 "Craig R. McClanahan" <cr...@apache.org>.
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.  That saves me the trouble.
>Excellent.
>  
>
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.

>	--- Noel
>  
>
Craig




---------------------------------------------------------------------
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 "Noel J. Bergman" <no...@devtech.com>.
> 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.  That saves me the trouble.
Excellent.

	--- 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 Dennis Lundberg <de...@mdh.se>.
Serge Knystautas wrote:
> Noel J. Bergman wrote:
> 
>>> I've been looking through the DBCP source this morning and have noticed
>>> several instances where System.out, System.err and printStackTrace()
>>> have been used to write error or status messages to the console.
>>
>>
>>> I'm wondering if there's any interest in a contribution that would
>>> replace these calls with calls to the commons-logging package instead?
>>
>>
>> YES!  :-)
>>
>> At least on my part.  Honestly, if you're going to tie Commons Pool 
>> and DBCP
>> to Logging, also introduce the idea of levels so that we get debugging,
>> info, error, etc., appropriate messages.
> 
> 
> How would commons-logging fit within the Avalon framework?  (James uses 
> DBCP now).

The upcoming version 1.0.4 of commons-logging has an AvalonLogger, which 
wraps the logger used by the Avalon framework.

--
Dennis Lundberg


---------------------------------------------------------------------
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 "Noel J. Bergman" <no...@devtech.com>.
> How would commons-logging fit within the Avalon framework?
> (James uses DBCP now).

I wrote an adapter once to bridge between DBCP and Avalon's logging.  If I
had to, I suppose I would write another, although having so many disparate
logging packages is a tad on the annoying side.

	--- 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 Serge Knystautas <se...@lokitech.com>.
Noel J. Bergman wrote:
>>I've been looking through the DBCP source this morning and have noticed
>>several instances where System.out, System.err and printStackTrace()
>>have been used to write error or status messages to the console.
> 
>>I'm wondering if there's any interest in a contribution that would
>>replace these calls with calls to the commons-logging package instead?
> 
> YES!  :-)
> 
> At least on my part.  Honestly, if you're going to tie Commons Pool and DBCP
> to Logging, also introduce the idea of levels so that we get debugging,
> info, error, etc., appropriate messages.

How would commons-logging fit within the Avalon framework?  (James uses 
DBCP now).

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
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 "Noel J. Bergman" <no...@devtech.com>.
> I've been looking through the DBCP source this morning and have noticed
> several instances where System.out, System.err and printStackTrace()
> have been used to write error or status messages to the console.

> I'm wondering if there's any interest in a contribution that would
> replace these calls with calls to the commons-logging package instead?

YES!  :-)

At least on my part.  Honestly, if you're going to tie Commons Pool and DBCP
to Logging, also introduce the idea of levels so that we get debugging,
info, error, etc., appropriate messages.

	--- Noel


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