1717import java .util .Set ;
1818import java .util .Map .Entry ;
1919
20+ import ch .qos .logback .classic .net .SMTPAppender ;
2021import ch .qos .logback .classic .spi .ILoggingEvent ;
2122import ch .qos .logback .classic .spi .IThrowableProxy ;
2223import ch .qos .logback .classic .spi .StackTraceElementProxy ;
3738 */
3839public class XMLLayout extends LayoutBase <ILoggingEvent > {
3940
40- private final int DEFAULT_SIZE = 256 ;
41- private final int UPPER_LIMIT = 2048 ;
41+ private static final int DEFAULT_SIZE = 256 ;
4242
43- private StringBuilder buf = new StringBuilder (DEFAULT_SIZE );
4443 private boolean locationInfo = false ;
4544 private boolean properties = false ;
4645
@@ -57,8 +56,10 @@ public void start() {
5756 *
5857 * <p>
5958 * If you are embedding this layout within an
60- * {@link org.apache.log4j.net.SMTPAppender} then make sure to set the
61- * <b>LocationInfo</b> option of that appender as well.
59+ * {@link SMTPAppender} then make sure to set the
60+ * {@link SMTPAppender#setIncludeCallerData(boolean) includeCallerData} option
61+ * as well.
62+ * </p>
6263 */
6364 public void setLocationInfo (boolean flag ) {
6465 locationInfo = flag ;
@@ -96,13 +97,7 @@ public boolean getProperties() {
9697 */
9798 public String doLayout (ILoggingEvent event ) {
9899
99- // Reset working buffer. If the buffer is too large, then we need a new
100- // one in order to avoid the penalty of creating a large array.
101- if (buf .capacity () > UPPER_LIMIT ) {
102- buf = new StringBuilder (DEFAULT_SIZE );
103- } else {
104- buf .setLength (0 );
105- }
100+ StringBuilder buf = new StringBuilder (DEFAULT_SIZE );
106101
107102 // We yield to the \r\n heresy.
108103
0 commit comments