Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def createConsoleAppender(): Unit = {
val lc: LoggerContext = LoggerFactory.getILoggerFactory.asInstanceOf[LoggerContext]
val ca = new ConsoleAppender[ILoggingEvent]
ca.setContext(lc)
ca.setName("console")
val encoder = new LayoutWrappingEncoder[ILoggingEvent]
encoder.setContext(lc)
val layout = new PatternLayout
layout.setPattern("%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n")
layout.setContext(lc)
layout.start()
encoder.setLayout(layout)
ca.setEncoder(encoder)
ca.start()
log.addAppender(ca)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment