logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23221] New: - SMTPAppender and NTEventLogAppender need newlines in throwable printouts
Date Wed, 17 Sep 2003 18:36:40 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23221>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23221

SMTPAppender and NTEventLogAppender need newlines in throwable printouts

           Summary: SMTPAppender and NTEventLogAppender need newlines in
                    throwable printouts
           Product: Log4j
           Version: 1.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Appender
        AssignedTo: log4j-dev@jakarta.apache.org
        ReportedBy: jmm@sublogic.com


WriterAppender and TelnetAppender both do the right thing in their subAppend 
methods if the layout ignores throwable - they write/append the lines with line 
separators.  Unfortunately, SMTPAppender and NTEventLogAppender do not, leaving 
their stack traces (I'm using SMTPAppender) a jumbled mess that's very 
difficult to deal with.

The fix is just adding a couple of append's of Layout.LINE_SEP like the other 2 
appenders already do, I'll go ahead and attach a patch as well although it's 
likely just as easy to type in the lines than apply the patch

/cygdrive/c/jakarta-log4j-1.2.8/src/java/org/apache/log4j> grep -A8 -ir 
layout.ignoresThrowable .
./net/SMTPAppender.java:        if(layout.ignoresThrowable()) {
./net/SMTPAppender.java-          String[] s = event.getThrowableStrRep();
./net/SMTPAppender.java-          if (s != null) {
./net/SMTPAppender.java-            for(int j = 0; j < s.length; j++) {
./net/SMTPAppender.java-              sbuf.append(s[j]);
./net/SMTPAppender.java-            }
./net/SMTPAppender.java-          }
./net/SMTPAppender.java-        }
./net/SMTPAppender.java-      }
--
./net/TelnetAppender.java:    if(layout.ignoresThrowable()) {
./net/TelnetAppender.java-      String[] s = event.getThrowableStrRep();
./net/TelnetAppender.java-      if (s != null) {
./net/TelnetAppender.java-      int len = s.length;
./net/TelnetAppender.java-      for(int i = 0; i < len; i++) {
./net/TelnetAppender.java-        sh.send(s[i]);
./net/TelnetAppender.java-        sh.send(Layout.LINE_SEP);
./net/TelnetAppender.java-      }
./net/TelnetAppender.java-      }
--
./nt/NTEventLogAppender.java:    if(layout.ignoresThrowable()) {
./nt/NTEventLogAppender.java-      String[] s = event.getThrowableStrRep();
./nt/NTEventLogAppender.java-      if (s != null) {
./nt/NTEventLogAppender.java-   int len = s.length;
./nt/NTEventLogAppender.java-   for(int i = 0; i < len; i++) {
./nt/NTEventLogAppender.java-     sbuf.append(s[i]);
./nt/NTEventLogAppender.java-   }
./nt/NTEventLogAppender.java-      }
./nt/NTEventLogAppender.java-    }
--
./WriterAppender.java:    if(layout.ignoresThrowable()) {
./WriterAppender.java-      String[] s = event.getThrowableStrRep();
./WriterAppender.java-      if (s != null) {
./WriterAppender.java-  int len = s.length;
./WriterAppender.java-  for(int i = 0; i < len; i++) {
./WriterAppender.java-    this.qw.write(s[i]);
./WriterAppender.java-    this.qw.write(Layout.LINE_SEP);
./WriterAppender.java-  }
./WriterAppender.java-      }

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


Mime
View raw message