From b839447f870c1f4d0ee78432bc179f4645e5880c Mon Sep 17 00:00:00 2001 From: Tal Moran Date: Thu, 12 Nov 2015 12:33:49 +0200 Subject: [PATCH] Added logback config file --- .../src/main/resources/logback.groovy | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 meerkat-common/src/main/resources/logback.groovy diff --git a/meerkat-common/src/main/resources/logback.groovy b/meerkat-common/src/main/resources/logback.groovy new file mode 100644 index 0000000..1eb8d7d --- /dev/null +++ b/meerkat-common/src/main/resources/logback.groovy @@ -0,0 +1,46 @@ + + +import ch.qos.logback.classic.encoder.PatternLayoutEncoder +import ch.qos.logback.classic.filter.ThresholdFilter +import ch.qos.logback.core.ConsoleAppender +import ch.qos.logback.core.util.Duration +import static ch.qos.logback.classic.Level.* + +if (System.getProperty("log.debug") != null) { + println "Logback configuration debugging enabled" + + statusListener(OnConsoleStatusListener) +} + +def LOG_LEVEL = toLevel(System.getProperty("log.level"), INFO) + +def haveBeagle = System.getProperty("log.beagle") != null +def logOps = System.getProperty("log.ops") != null + +appender("CONSOLE", ConsoleAppender) { + + filter(ThresholdFilter) { + level = toLevel(System.getProperty("log.level"), DEBUG) + } + + encoder(PatternLayoutEncoder) { + pattern = "%d{HH:mm:ss.SSS} [%thread %file:%line] %-5level %logger{0} - %msg%n" + } +} + +def appenders = [ "CONSOLE" ] + +if (haveBeagle) { + appender("SOCKET", SocketAppender) { + includeCallerData = true + remoteHost = "localhost" + port = 4321 + reconnectionDelay = new Duration(10000) + } + + appenders += ["SOCKET"] +} + +root(LOG_LEVEL, appenders) + +