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 Geoff Soutter <ge...@molten.com.au> on 2002/03/27 02:20:05 UTC

PATCH: SMTPAppender stack trace bug

Hi there,

Whilst on the topic of stack trace bugs, I found this a while back but
never reported it.

SMTPAppender generates stack traces which have all the lines on the
trace concatenated into one line. Very hard to read!

All that is required to fix it is to add the indicated line to
SMTPAppender.sendBuffer() 

if(layout.ignoresThrowable()) {
  String[] s = event.getThrowableStrRep();
  if (s != null) {
    for(int j = 0; j < s.length; j++) {
      sbuf.append(s[j]);
      // NOTE: add this line
      sbuf.append(Layout.LINE_SEP);
    }
  }
}

At least there should be no debate about this one ... :-)

Also, for extra points, notice how letting "s" contain embedded line
feeds could cause appenders to screw up.

Cheers,

Geoff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>