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: Extending log4j Logger
Date Wed, 15 Nov 2006 12:40:14 GMT
Generally extending Logger is a bad idea.  Search the archives for more info.

On 11/14/06, GoodOne <monacobabe@gmail.com> wrote:
> Greetings!
>
> I am trying to do this but logging agasint the object returned gives me
> NullPointer exception.
>
> If I extend the Logger class and use proper constructor why shoudl it give
> problem? If I use
> return  Logger.getLogger(name);  instead of return  new MyLogger(name);
>  it works fine.
>
>
> public final class MyLogger extends Logger{
>
>  protected MyLogger(String name){
>   super(name);
>  }
>
>  public static org.apache.log4j.Logger getLoggerInstance(String name){
>   return  new MyLogger(name);
>  }
> }
>
> Thank you.
> The Good One.
>
>
>
>
> On 11/14/06, GoodOne <monacobabe@gmail.com> wrote:
> >
> > Greetings!
> >  I am trying to extend log4j Logger, something like class A subclassing
> > Logger. I would like to have an instance of class A returned than log4j
> > Logger's instance.
> > Any idea?
> > Thank you,
> > The Good One.
> >
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
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