Skip to content
Snippets Groups Projects
Commit fa6c3f8a authored by Sebastian's avatar Sebastian
Browse files

Set logback log level correctly depending on CLI options

parent be0a0150
Branches master
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ dependencies {
implementation 'de.topobyte:melon-resources:0.0.1'
implementation 'de.topobyte:chromaticity-awt:0.0.2'
runtimeOnly 'ch.qos.logback:logback-classic:1.2.3'
implementation 'ch.qos.logback:logback-classic:1.2.3'
def daggerVersion = '2.24'
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
......
package org.briarproject.briar.swing
import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.counted
import com.github.ajalt.clikt.parameters.options.default
......@@ -10,6 +12,7 @@ import org.briarproject.bramble.BrambleCoreEagerSingletons
import org.briarproject.bramble.api.plugin.TorConstants.DEFAULT_CONTROL_PORT
import org.briarproject.bramble.api.plugin.TorConstants.DEFAULT_SOCKS_PORT
import org.briarproject.briar.BriarCoreEagerSingletons
import org.slf4j.LoggerFactory
import java.io.File
import java.io.File.separator
import java.io.IOException
......@@ -55,10 +58,10 @@ private class Main : CliktCommand(
override fun run() {
// logging
val levelSlf4j = if (debug) "DEBUG" else when (verbosity) {
0 -> "WARN"
1 -> "INFO"
else -> "DEBUG"
val levelLogback = if (debug) Level.DEBUG else when (verbosity) {
0 -> Level.WARN
1 -> Level.INFO
else -> Level.DEBUG
}
val level = if (debug) ALL else when (verbosity) {
0 -> WARNING
......@@ -66,6 +69,9 @@ private class Main : CliktCommand(
else -> ALL
}
val root: Logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME) as Logger
root.level = levelLogback
LogManager.getLogManager().getLogger("").level = level
val dataDir = getDataDir()
......
......@@ -113,7 +113,6 @@ dependencyVerification {
'org.objenesis:objenesis:3.0.1:objenesis-3.0.1.jar:7a8ff780b9ff48415d7c705f60030b0acaa616e7f823c98eede3b63508d4e984',
'org.opentest4j:opentest4j:1.2.0:opentest4j-1.2.0.jar:58812de60898d976fb81ef3b62da05c6604c18fd4a249f5044282479fc286af2',
'org.skyscreamer:jsonassert:1.5.0:jsonassert-1.5.0.jar:a310bc79c3f4744e2b2e993702fcebaf3696fec0063643ffdc6b49a8fb03ef39',
'org.slf4j:slf4j-api:1.7.25:slf4j-api-1.7.25.jar:18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79',
'org.slf4j:slf4j-api:1.7.26:slf4j-api-1.7.26.jar:6d9e5b86cfd1dd44c676899285b5bb4fa0d371cf583e8164f9c8a0366553242b',
'org.swinglabs:jxlayer:3.0.4:jxlayer-3.0.4.jar:5dec074eecb14b12dd456a98df59bb7d7245ebac65ff67640c2631f232c961aa',
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment