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 12:13:47 GMT
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?

search for log4j conversion patterns bought up this page, which should
be quite a good starting point:

... and based on that, what you have there is
- %d{ABSOLUTE}: timestamp formatted as "HH:mm:ss,SSS"
- %5p: logging event priority in a 5-character field
- %c{1}: logging category (often a classname; {1} specifies that only 
the rightmost component is printed
- %L: line number in the code file (docs warn that this is slow)
- %m: actual message logged in the code
- %n: line separator

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

Your stack trace seems to correlate very well with this pattern; the 
"%d{ABSOLUTE}" does use the AbsoluteTimeDateFormat which shows up
in your original stack trace:

log4j:ERROR Error occured while converting date.
         at java.lang.System.arraycopy(Native Method)
         at java.lang.StringBuffer.getChars(StringBuffer.java:201)
         at java.text.DateFormat.format(DateFormat.java:316)

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

View raw message