You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2006/12/20 16:30:15 UTC

DO NOT REPLY [Bug 41219] New: - Stacktraces of exceptions disappear occsionally

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41219

           Summary: Stacktraces of exceptions disappear occsionally
           Product: Log4j
           Version: 1.2
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: major
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: mr.kari.ikonen@gmail.com


Sometimes stacktraces of the exceptions seem to mysteriously disappear. After 
invesigation I noticed thatThrowableInformation.VectorWriter looks potentially 
unrobust, since it's making strong assumptions of what methods of the 
PrintWriter API Throwable is using for printing its' stacktrace.

For example, if Throwable uses some "write(int)" method then stacktrace goes 
appearently into /dev/null.

It's completely possible that some sub-class of Throwable overrides 
printStackTrace() -logic, so API shouldn't make assumptions based into 
implementation details inside Throwable (Throwable itself could change also 
logic, like has happened earlier).

This issue reduces reliability of Log4J considerably.

PROOF:
---------------------
package org.kari;

import java.io.PrintWriter;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

public class ThrowableTest {
    
    public static final class ThrowableFail extends Throwable {

        @Override
        public void printStackTrace(PrintWriter s)
        {
            super.printStackTrace(s);
            s.println("LOST-START");
            // Following output is lost
            for (int i= 0; i < 100; i++) {
                s.print('a');
            }
            s.println("LOST-END");
        }
        
    }
    
    public static void main(String[] args) {
        BasicConfigurator.configure();
        Logger LOG = Logger.getLogger(ThrowableTest.class);
        LOG.info("Test", new ThrowableFail());
    }

}
---------------------

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41219] - Stacktraces of exceptions disappear occsionally

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41219





------- Additional Comments From mr.kari.ikonen@gmail.com  2007-01-29 21:01 -------
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.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41219] - Stacktraces of exceptions disappear occsionally

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41219


carnold@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From carnold@apache.org  2007-02-21 13:43 -------
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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41219] - Stacktraces of exceptions disappear occsionally

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41219





------- Additional Comments From bayard@apache.org  2007-01-25 17:23 -------
I get the same when I run Kari's code against trunk.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41219] - Stacktraces of exceptions disappear occsionally

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41219


carnold@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |40951
              nThis|                            |




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41219] - Stacktraces of exceptions disappear occsionally

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41219





------- Additional Comments From bayard@apache.org  2007-01-29 14:40 -------
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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41219] - Stacktraces of exceptions disappear occsionally

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41219





------- Additional Comments From mr.kari.ikonen@gmail.com  2006-12-20 08:07 -------
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


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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