commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <Joerg.Schai...@Elsag-Solutions.com>
Subject RE: [logging] Logger.getName
Date Wed, 28 Sep 2005 06:34:41 GMT
Joerg Hohwiller wrote on Wednesday, September 28, 2005 12:40 AM:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi everybody,
> 
> since nothing happened after I opened bugzilla issue 15939
> and called for discussion, I simply started changing all
> implementations of Log so they implement Logger instead (all
> locally). I will supply the patch, when I am done.
> 
> Now what I found out when worked on LogKitLogger, is that
> they deperected the "getCategory()" method which is the
> analogy of the invented "getName()" method. Their deprecation
> is: <quote> Deprecated. This method violates Inversion of
> Control principle. If you are relying on its presence then
> there may be something wrong with the design of your system </quote>
> http://www.keelframework.org/release/2.1-dev/javadoc/org/apache/log/Logger.html#getCategory()
>
> Actually it seems they have now even completely removed the method:
> https://svn.apache.org/repos/asf/excalibur/trunk/containerkit/logkit/src/java/org/apache/log/Logger.java
>
> I can not see the point (esp. when there are methods as
> "public synchronized Logger[] getChildren()")?
>
> Can someone give me a hint?
>
> I do not really need the "getName()" method and could also leave it out
> of Logger. But for me it would still make sense to have the method and
> it would be possible to implement it.

Well, since getCategory is already gone, you cannot implement getName anymore in a compatible
matter. What will work as alternative is: 

	Logger getChild(String name)

This is basically, what Niclas proposed as use case for getName():

	Logger loggfer = Logger.getLogger(parentLogger.getName + ".child");

getChild can be implemented for all logger packages that either support getName or have getChild
... and this seems all of them. WDYT?

- Jörg

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


Mime
View raw message