You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jeff Drew <je...@gmail.com> on 2005/12/07 14:01:41 UTC

log4j stack trace

My application had an error in the log4j code.  It is likely a problem in my
code, but I'd appreciate any insights into what this particular error
implies.   This code has been running for quite without seeing this error.

java.lang.NullPointerException
    at java.lang.String.intern()Ljava.lang.String;(Unknown Source)
    at org.apache.log4j.CategoryKey.<init>(Ljava.lang.String;)V(
CategoryKey.java:20)
    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
;Lorg.apache.log4j.spi.LoggerFactory;)Lorg.apache.log4j.Logger;(
Hierarchy.java:252)
    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
;)Lorg.apache.log4j.Logger;(Hierarchy.java:233)

Thanks

Re: log4j stack trace

Posted by James Stauffer <st...@gmail.com>.
I don't know of any way that could happen. :-/

On 12/7/05, Jeff Drew <je...@gmail.com> wrote:
> I use a String as the argument.  It's crude, but I thought it would never
> break.
>
>  static final Logger logger = Logger.getLogger("LoggerName");
>
> Is it possible for the String to become null?
>
>
> On 12/7/05, Nicolas De Loof <ni...@capgemini.com> wrote:
> >
> >
> > your Nullpointer is thrown in CategoryKey constructor :
> >   CategoryKey(String name) {
> >     this.name = name;
> > >    hashCache = name.hashCode();
> >   }
> >
> > This sounds like you try to create a logger with a null category name.
> >
> > To avoid this, you may use the class to build your loggers :
> > private static Logger logger = Logger.getLogger(MyClass.class);
> >
> > Nico
> >
> > Jeff Drew a écrit :
> >
> > >My application had an error in the log4j code.  It is likely a problem in
> > my
> > >code, but I'd appreciate any insights into what this particular error
> > >implies.   This code has been running for quite without seeing this
> > error.
> > >
> > >java.lang.NullPointerException
> > >    at java.lang.String.intern()Ljava.lang.String;(Unknown Source)
> > >    at org.apache.log4j.CategoryKey.<init>(Ljava.lang.String;)V(
> > >CategoryKey.java:20)
> > >    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
> > >;Lorg.apache.log4j.spi.LoggerFactory;)Lorg.apache.log4j.Logger;(
> > >Hierarchy.java:252)
> > >    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
> > >;)Lorg.apache.log4j.Logger;(Hierarchy.java:233)
> > >
> > >Thanks
> > >
> > >
> > >
> >
> > This message contains information that may be privileged or confidential
> > and is the property of the Capgemini Group. It is intended only for the
> > person to whom it is addressed. If you are not the intended recipient,  you
> > are not authorized to read, print, retain, copy, disseminate,  distribute,
> > or use this message or any part thereof. If you receive this  message in
> > error, please notify the sender immediately and delete all  copies of this
> > message.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>


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


Re: log4j stack trace

Posted by Jeff Drew <je...@gmail.com>.
I use a String as the argument.  It's crude, but I thought it would never
break.

 static final Logger logger = Logger.getLogger("LoggerName");

Is it possible for the String to become null?


On 12/7/05, Nicolas De Loof <ni...@capgemini.com> wrote:
>
>
> your Nullpointer is thrown in CategoryKey constructor :
>   CategoryKey(String name) {
>     this.name = name;
> >    hashCache = name.hashCode();
>   }
>
> This sounds like you try to create a logger with a null category name.
>
> To avoid this, you may use the class to build your loggers :
> private static Logger logger = Logger.getLogger(MyClass.class);
>
> Nico
>
> Jeff Drew a écrit :
>
> >My application had an error in the log4j code.  It is likely a problem in
> my
> >code, but I'd appreciate any insights into what this particular error
> >implies.   This code has been running for quite without seeing this
> error.
> >
> >java.lang.NullPointerException
> >    at java.lang.String.intern()Ljava.lang.String;(Unknown Source)
> >    at org.apache.log4j.CategoryKey.<init>(Ljava.lang.String;)V(
> >CategoryKey.java:20)
> >    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
> >;Lorg.apache.log4j.spi.LoggerFactory;)Lorg.apache.log4j.Logger;(
> >Hierarchy.java:252)
> >    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
> >;)Lorg.apache.log4j.Logger;(Hierarchy.java:233)
> >
> >Thanks
> >
> >
> >
>
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient,  you
> are not authorized to read, print, retain, copy, disseminate,  distribute,
> or use this message or any part thereof. If you receive this  message in
> error, please notify the sender immediately and delete all  copies of this
> message.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Re: log4j stack trace

Posted by Nicolas De Loof <ni...@capgemini.com>.
your Nullpointer is thrown in CategoryKey constructor :
  CategoryKey(String name) {
    this.name = name;
 >    hashCache = name.hashCode();
  }

This sounds like you try to create a logger with a null category name.

To avoid this, you may use the class to build your loggers :
private static Logger logger = Logger.getLogger(MyClass.class);

Nico

Jeff Drew a écrit :

>My application had an error in the log4j code.  It is likely a problem in my
>code, but I'd appreciate any insights into what this particular error
>implies.   This code has been running for quite without seeing this error.
>
>java.lang.NullPointerException
>    at java.lang.String.intern()Ljava.lang.String;(Unknown Source)
>    at org.apache.log4j.CategoryKey.<init>(Ljava.lang.String;)V(
>CategoryKey.java:20)
>    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
>;Lorg.apache.log4j.spi.LoggerFactory;)Lorg.apache.log4j.Logger;(
>Hierarchy.java:252)
>    at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
>;)Lorg.apache.log4j.Logger;(Hierarchy.java:233)
>
>Thanks
>
>  
>

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: log4j stack trace

Posted by James Stauffer <st...@gmail.com>.
My first guess is that you are calling Logger.getLogger(null)

On 12/7/05, Jeff Drew <je...@gmail.com> wrote:
> My application had an error in the log4j code.  It is likely a problem in my
> code, but I'd appreciate any insights into what this particular error
> implies.   This code has been running for quite without seeing this error.
>
> java.lang.NullPointerException
>     at java.lang.String.intern()Ljava.lang.String;(Unknown Source)
>     at org.apache.log4j.CategoryKey.<init>(Ljava.lang.String;)V(
> CategoryKey.java:20)
>     at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
> ;Lorg.apache.log4j.spi.LoggerFactory;)Lorg.apache.log4j.Logger;(
> Hierarchy.java:252)
>     at org.apache.log4j.Hierarchy.getLogger(Ljava.lang.String
> ;)Lorg.apache.log4j.Logger;(Hierarchy.java:233)
>
> Thanks
>
>


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