commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boris Unckel" <boris.unckel....@gmx.net>
Subject Re: logging: How to configure programatically for using java.util.logging
Date Thu, 06 Apr 2006 11:37:40 GMT
Hello,

by mistake I responded directly to Simon and not the list.
Here my remark and his answer.

Regards
Boris

Von: Simon Kitching <skitching@apache.org>
On Thu, 2006-04-06 at 12:05 +0200, Boris Unckel wrote:
> Hello,
> > Von: Simon Kitching <skitching@apache.org>
> > On Thu, 2006-04-06 at 02:47 -0700, David wrote:
> > > Dear members,
> > >    
> > > I would like to use java.util.logging and configure it
> > > programatically, on the common-logging documentation there is 
> > > information about how to do
> > > it with the properties files, but I don't see the way for doing 
> > > directly on the source code.
> > >
> > > I have a simple class that have setLogger/getLogger, I just wanto to
> > > test in a tester class how should work for using java.util.loggins or 
> > >the Simple log from commons.
> > commons-logging does not provide *any* mechanism for configuring the
> > "real" underlying logging library (except for the special case of the
> There is a small misunderstanding:
> As I understand, he wants to know how to configure commons-logging not by
> property but by code. He is not interested in a "configure-the-underlying"
> method.

Ah, you might be right..

> As I currently know, there is no method available to choose the
> underlying-API from user code. You would have to provide your own
> implementation of the discovery and factory mechanism.

There *is* such a mechanism. This call:
  LogFactory.getFactory().setAttribute(
	"org.apache.commons.logging.Log",
        "org.apache.commons.logging.impl.JDK14Log");
will force the use of java.util.logging.

Of course it needs to be called before any Log instances are created...

Cheers,

Simon

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


Mime
View raw message