Summary: | Stacktraces of exceptions disappear occsionally | ||
---|---|---|---|
Product: | Log4j - Now in Jira | Reporter: | Kari Ikonen <mr.kari.ikonen> |
Component: | Appender | Assignee: | log4j-dev <log4j-dev> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 1.2 | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | other | ||
Bug Depends on: | |||
Bug Blocks: | 40951 |
Description
Kari Ikonen
2006-12-20 07:30:15 UTC
Related: - Bug 34945 ThrowableInformation has dubious Stack Trace extraction feature - Bug 35324 Stacktrace may choke on null fields, as org.apache.log4j.spi.ThrowableInformation.VectorWriter.println(null) will bomb - Bug 36587 Printing throwable stacktrace throwing null pointer exception I get the same when I run Kari's code against trunk. One simple improvement would be to ensure that all the methods in PrintWriter are implemented by VectorWriter. I don't see why print(int) etc can't be implemented - it looks like they've been there since 1.1. JDK 1.5 added a bunch of methods to VectorWriter, so if Exceptions use these then the same bug will exist. Basically, only lowest level write methods should be overridden, i.e. the ones into which all the other calls end up. This means overriding only "public void write(int c)" in the Writer, which is passed as constructor arg to PrintWriter (thus changing logic a bit). And division into lines would happens then by detecting linefeed. Fixes committed against 1.2 branch in rev 510214 and against trunk in 510242. Basically gutted the existing VectorWriter/NullWriter approach and passed a PrintWriter wrapping a StringWriter to printStackTrace and then used LineNumberReader to parse the output into lines. |