I config a SMTPAppender
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<Subject>TESTING: %logger
{20}
- %m</Subject>
<SMTPHost>$
{smtpHost}
</SMTPHost>
<To>$
{to}
</To>
<From>$
{from}
</From>
<charsetEncoding>utf-8</charsetEncoding>
<includeCallerData>true</includeCallerData>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d
{yyyy-MM-dd HH:mm:ss}
%-5level (%F:%L) %method() - %m%n</pattern>
</layout>
<cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
<bufferSize>2</bufferSize>
</cyclicBufferTracker>
</appender>
I set bufferSize value =2
But when i run my java code:
public class HelloWorldTest{
private static final Logger log = LoggerFactory.getLogger(HelloWorldTest.class);
@Test
public void testHelloWorldTest() throws InterruptedException{
for (int i = 0; i < 3; ++i)
{
log.error("hello world");
}
Thread.sleep(TimeInterval.SECONDS_PER_MINUTE * 1000 / 1);
}
}
I got three emails,and each email show content:
2015-04-26 23:38:56 ERROR (HelloWorldTest.java:40) testHelloWorldTest() - hello world
I just want to got two email,
first one content show 2 line infos:
2015-04-26 23:38:56 ERROR (HelloWorldTest.java:40) testHelloWorldTest() - hello world
2015-04-26 23:38:56 ERROR (HelloWorldTest.java:40) testHelloWorldTest() - hello world
second one,content show just 1 line infos:
2015-04-26 23:38:56 ERROR (HelloWorldTest.java:40) testHelloWorldTest() - hello world
The SMTPAppender's cyclicBufferTracker bufferSize param does't work
|