logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Stauffer" <stauffer.ja...@gmail.com>
Subject Re: Declaration of loggers
Date Fri, 21 Jul 2006 18:39:50 GMT
How about this.  Then each sub-class has its own logger and it isn't much work.

protected Logger logger_m = Logger.getLogger(getClass());

On 7/21/06, Harp, George <GHarp@gainsystems.com> wrote:
> Hello,
>    I am used to declaring Loggers in my code the following way
>
> private final static Logger logger_m = Logger.getLogger( MyClass.class
> );
>
> A co worker wants do declare loggers from a base class so that each sub
> class has a seperate logger
>
> public class BaseClass
> {
>     private Logger logger_m = Logger.getLogger( MyClass.class );
>
>     public Logger createLogger( Object baseObject )
>     {
>         logger_m = Logger.getLogger(  baseObject.getClass( ) );
>     }
>     public Logger getLogger( )
>     {
>         return( logger_m );
>     }
> }
>
> I feel the second approach is to much effort when the first and "normal"
> approach if a 1 liner, but i need to know if there are any ramifications
> of the second approach?
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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


Mime
View raw message