commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Hohwiller <jo...@j-hohwiller.de>
Subject Re: [logging] Logger.getName
Date Wed, 28 Sep 2005 18:36:07 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jörg Schaible wrote:
> 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.
Yes and no. For some logger implementations I can not get the name back
from the actual logger insance. But after all "we" are the ones who
construct the loggers and have the adapters. So we can store the name
together with the actual adapted logger instance.
This has already been done for many of the adapter implemenetations.

> 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?
Yes. "getChildLogger" can be implemented in an appropriate way (while
NoLogger returns itself) for all of them without trouble.

So the question still is if I should implement getName() or kick it out.
> 
> - Jörg
Regards
  Jörg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDOuKXmPuec2Dcv/8RAuuiAJ9F3RXjDyISUwHkYjzWCG3kj1B45QCdFz+E
CxxjCHHlQBIIeLtXo0JR6vg=
=2wUr
-----END PGP SIGNATURE-----

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