[logback-user] Log file is created but it is empty

Rice Yeh riceyeh at gmail.com
Thu Feb 6 09:06:09 CET 2014


I am using logback version 1.0.11 with the following configuration. The log
file is created but it is empty. That is, no log messages are put into it?
What is wrong with my configuration?

appender("close-period", GSiftingAppender) {
discriminator(MDCBasedDiscriminator) {
key = "period"
defaultValue = "unknown"
}
//timeout = "1 minutes"
sift {
appender("close-${period}", FileAppender) {
file = "${logDir}/close-${period}.log"
append = false
layout(PatternLayout) {
pattern = "%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n"
}
}
}
}
logger("mlm.close_period", INFO, ["close-period"], false)


the test code is

@Test
def testClosePeriod {
import org.slf4j.MDC
val logger = LoggerFactory.getLogger("mlm.close_period")
MDC.put("period", "2014-02")
logger.info("testClosePeriod is run")
MDC.remove("period")
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20140206/7909db6b/attachment.html>


More information about the Logback-user mailing list