logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GoodOne <monacob...@gmail.com>
Subject Re: Extending log4j Logger
Date Tue, 14 Nov 2006 22:17:47 GMT
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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message