// See also http://jira.qos.ch/browse/LOGBACK-734 @Test public void callerDataShouldBeCorrectlySetWithAsyncronousSending() throws Exception { buildSMTPAppender(smtpServer.getSmtp().getPort(), ASYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(lc, DEFAULT_PATTERN)); smtpAppender.setIncludeCallerData(true); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("hello"); logger.error("an error", new Exception("an exception")); waitUntilEmailIsSent(); MimeMultipart mp = verify(smtpServer, TEST_SUBJECT); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertTrue(body.contains("DEBUG " + this.getClass().getName() + " - hello")); }
// See also http://jira.qos.ch/browse/LOGBACK-734 @Test public void callerDataShouldBeCorrectlySetWithAsynchronousSending() throws Exception { String subject = "LOGBACK-734"; buildSMTPAppender("LOGBACK-734", ASYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); smtpAppender.setIncludeCallerData(true); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("LOGBACK-734"); logger.error("callerData", new Exception("ShouldBeCorrectlySetWithAsynchronousSending")); waitUntilEmailIsSent(); MimeMultipart mp = verifyAndExtractMimeMultipart(subject); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertTrue( "actual [" + body + "]", body.contains("DEBUG " + this.getClass().getName() + " - LOGBACK-734")); }