gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libeufin] branch master updated: Use logback.xml.


From: gnunet
Subject: [GNUnet-SVN] [libeufin] branch master updated: Use logback.xml.
Date: Tue, 08 Oct 2019 16:12:56 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 404e610  Use logback.xml.
404e610 is described below

commit 404e610a5898be5cd56e52b7543473fb785da18e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Oct 8 16:12:37 2019 +0200

    Use logback.xml.
---
 nexus/src/main/kotlin/Main.kt        |  4 ++--
 resources/logback.xml                | 11 +++++++++++
 sandbox/src/main/kotlin/GetLogger.kt | 35 -----------------------------------
 sandbox/src/main/kotlin/Main.kt      |  3 ++-
 sandbox/src/test/kotlin/LogTest.kt   | 16 ++++++++++++++++
 sandbox/src/test/kotlin/XmlTest.kt   |  4 ++--
 6 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt
index 136f7fa..fc35ac8 100644
--- a/nexus/src/main/kotlin/Main.kt
+++ b/nexus/src/main/kotlin/Main.kt
@@ -29,11 +29,11 @@ import io.ktor.routing.post
 import io.ktor.routing.routing
 import io.ktor.server.engine.embeddedServer
 import io.ktor.server.netty.Netty
-import tech.libeufin.sandbox.getLogger
+import org.slf4j.LoggerFactory
 
 fun main() {
 
-    val logger = getLogger()
+    val logger = LoggerFactory.getLogger("tech.libeufin.nexus")
 
     val server = embeddedServer(Netty, port = 5001) {
 
diff --git a/resources/logback.xml b/resources/logback.xml
new file mode 100644
index 0000000..6eea430
--- /dev/null
+++ b/resources/logback.xml
@@ -0,0 +1,11 @@
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - 
%msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="debug">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>
\ No newline at end of file
diff --git a/sandbox/src/main/kotlin/GetLogger.kt 
b/sandbox/src/main/kotlin/GetLogger.kt
deleted file mode 100644
index 83f2c50..0000000
--- a/sandbox/src/main/kotlin/GetLogger.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package tech.libeufin.sandbox
-
-import ch.qos.logback.classic.Level
-import org.slf4j.LoggerFactory
-import ch.qos.logback.core.FileAppender
-import ch.qos.logback.classic.spi.ILoggingEvent
-import ch.qos.logback.classic.Logger
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder
-import ch.qos.logback.classic.LoggerContext
-
-fun getLogger(): Logger {
-    val lc: LoggerContext = LoggerFactory.getILoggerFactory() as LoggerContext
-    val logger: Logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME) as 
Logger
-    val fa = FileAppender<ILoggingEvent>()
-    val le = PatternLayoutEncoder()
-
-    // appender setup
-    fa.context = lc
-    fa.name = "libeufin"
-    fa.isAppend = true
-    fa.file = "server.log"
-
-    // encoder setup
-    le.context = lc
-    le.pattern = "%date [%level]: %msg\n"
-
-    // link && start
-    le.start()
-    fa.encoder = le
-    fa.start()
-    logger.addAppender(fa)
-
-    logger.level = Level.DEBUG
-    return logger
-}
diff --git a/sandbox/src/main/kotlin/Main.kt b/sandbox/src/main/kotlin/Main.kt
index b2ad70e..cffc36d 100644
--- a/sandbox/src/main/kotlin/Main.kt
+++ b/sandbox/src/main/kotlin/Main.kt
@@ -36,6 +36,7 @@ import io.ktor.routing.routing
 import io.ktor.server.engine.embeddedServer
 import io.ktor.server.netty.Netty
 import org.jetbrains.exposed.sql.transactions.transaction
+import org.slf4j.LoggerFactory
 import org.w3c.dom.Document
 import tech.libeufin.messages.HEVResponseDataType
 import java.text.DateFormat
@@ -43,7 +44,7 @@ import javax.xml.bind.JAXBElement
 
 fun main() {
 
-    val logger = getLogger()
+    val logger = LoggerFactory.getLogger("tech.libeufin.sandbox")
     val xmlProcess = XML()
 
     dbCreateTables()
diff --git a/sandbox/src/test/kotlin/LogTest.kt 
b/sandbox/src/test/kotlin/LogTest.kt
new file mode 100644
index 0000000..e5dffb9
--- /dev/null
+++ b/sandbox/src/test/kotlin/LogTest.kt
@@ -0,0 +1,16 @@
+package tech.libeufin.sandbox
+
+import org.junit.Assert
+import org.junit.Test
+import org.junit.Assert.*
+import org.slf4j.LoggerFactory
+
+class LogTest {
+
+    @Test
+    fun logLine() {
+        val logger = LoggerFactory.getLogger("sandbox.log.test")
+        logger.info("line")
+    }
+}
+
diff --git a/sandbox/src/test/kotlin/XmlTest.kt 
b/sandbox/src/test/kotlin/XmlTest.kt
index b07f5af..ca3176b 100644
--- a/sandbox/src/test/kotlin/XmlTest.kt
+++ b/sandbox/src/test/kotlin/XmlTest.kt
@@ -1,4 +1,4 @@
-package tech.libeufin
+package tech.libeufin.sandbox
 
 import org.junit.Assert
 import org.junit.Test
@@ -9,7 +9,7 @@ import javax.xml.transform.stream.StreamSource
 
 class XmlTest {
 
-    val processor = XML()
+    val processor = tech.libeufin.sandbox.XML()
 
     @Test
     fun hevValidation(){

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]