You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Jason Zheng <JZ...@screamingmedia.com> on 2002/01/06 00:02:38 UTC
log in static method?
Is there a standard way to get logger in static method? The getLogger() in
AbstractLoggable is non-static. I was using log4j and log4j requires a
static Category class member to solve this problem. I just could not find
the counterpart in Avalon framework.
Thank you
Jason Zheng
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: log in static method?
Posted by Peter Donald <pe...@apache.org>.
On Sun, 6 Jan 2002 10:02, Jason Zheng wrote:
> Is there a standard way to get logger in static method? The getLogger() in
> AbstractLoggable is non-static. I was using log4j and log4j requires a
> static Category class member to solve this problem. I just could not find
> the counterpart in Avalon framework.
There is no equivelent because it is considered a bad design and we attempt
to block bad design. Ideally it should be refactored such that;
1. the method is non-static and part of a service
2. the method does not log but throws meaningful exceptions which clients log
3. the method accepts context information (like a Logger object) which it
uses during the "request"
4. You shortcut that and directly use LogKit or Log4j or whatever the
underlying framework is
4 is the least desirable, 1/2 are the best methods while 3 is sort of a work
around
--
Cheers,
Pete
---------------------------------------------------
"Therefore it can be said that victorious warriors
win first, and then go to battle, while defeated
warriors go to battle first, and then seek to win."
- Sun Tzu, the Art Of War
---------------------------------------------------
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>