Skip to content

Commit 0091c0c

Browse files
committed
fixes LOGBACK-427
Signed-off-by: ceki <[email protected]>
1 parent 916b691 commit 0091c0c

File tree

1 file changed

+7
-12
lines changed
  • logback-classic/src/main/java/ch/qos/logback/classic/log4j

1 file changed

+7
-12
lines changed

logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.Set;
1818
import java.util.Map.Entry;
1919

20+
import ch.qos.logback.classic.net.SMTPAppender;
2021
import ch.qos.logback.classic.spi.ILoggingEvent;
2122
import ch.qos.logback.classic.spi.IThrowableProxy;
2223
import ch.qos.logback.classic.spi.StackTraceElementProxy;
@@ -37,10 +38,8 @@
3738
*/
3839
public 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

Comments
 (0)