logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juha Laiho <Juha.La...@iki.fi>
Subject Re: bizarre NPE exception
Date Sat, 14 Nov 2009 13:37:01 GMT
Juha Laiho wrote:
> Pat Farrell wrote:
>> Juha Laiho wrote:
>>> Looks like the error has more to do with your Log4j configuration than
>>> the code doing the logging. Looks like some date pattern conversion
>>> is encountering an unexpected null.
>> OK, tis possible since I don't get some of the config stuff.
>> This is my universal format line:
>> log4j.appender.fnfbookfile.layout.ConversionPattern=
>>   %d{ABSOLUTE} %5p %c{1}:%L - %m%n
>> Where should I begin to debug this?
> ... of these, it looks like the error source would be in the code doing 
> the work for your %d{ABSOLUTE} -- in which sense this could be an error 
> in log4j code.
> Which exact log4j version are you using?
> Also, which JVM do you use - as that also plays a part in this?

... responding to myself (and feeling silly because of that); I 
retrieved the log4j source, and at least the line numbers in your trace 
seem to match 1.2.15.

That being said, I'm somewhat at loss as to how a NullPointerException 
would be thrown in this. Drilling down through the stack trace, the NPE 
is initially thrown by System.arrayCopy, which is documented to throw it 
when either source or destination arrays are null.

Looking at the call on line 119 of 
org.apache.log4j.helpers.AbsoluteTimeDateFormat.format, there is:
       // store the time string for next time to avoid recomputation
       sbuf.getChars(start, sbuf.length(), previousTimeWithoutMillis, 0);

... and the arraycopy source is the value of sbuf, and destination is 
previousTimewithOutMillis, which is declared and initialized in 
AbsoluteTimeDateFormat as follows:
private static char[] previousTimeWithoutMillis = new char[9];

.... so, I feel I'm getting out of my depth: I don't see how either of 
these could be null.

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

View raw message