VectorWriter extends java.io.PrintWriter but it does not suppply its forgiving services when trying to println(null). Each of Sun's implementations of println (Object) is capable of handling the singular case of Object==null gracefully, but ThrowableInformation.VectorWriter does not, which effectively breaks custom made printStackTrace methods at the very instant, when the stack trace is to be output to a logger. In detail, org.apache.log4j.spi.ThrowableInformation.VectorWriter.println (Object) looks as follows: public void println(Object o) { v.addElement(o.toString()); } whilst it might preferrably be: public void println(Object o) { v.addElement(String.valueOf(o)); }
Good catch and good suggestion: I've applied it to CVS HEAD in time for log4j 1.3-alpha7.
Reopening for log4j 1.2 branch
Committed interim fix in rev 510097. Expect to gut existing implementation in just a few moments.
Issue mooted by fix for bug 41219.
*** Bug 36587 has been marked as a duplicate of this bug. ***