mirror of
https://github.com/corda/corda.git
synced 2025-01-18 02:39:51 +00:00
CORDA-2725: Set DJVM CLI logging threshold to "TRACE". (#4867)
- Configure root logging level programmatically. - Support DEBUG logging level.
This commit is contained in:
parent
061db8b1a1
commit
9648b16ff1
@ -8,6 +8,8 @@ import net.corda.djvm.references.ClassReference
|
||||
import net.corda.djvm.references.EntityReference
|
||||
import net.corda.djvm.references.MemberReference
|
||||
import net.corda.djvm.rewiring.SandboxClassLoadingException
|
||||
import org.apache.logging.log4j.Level
|
||||
import org.apache.logging.log4j.core.config.Configurator
|
||||
import picocli.CommandLine
|
||||
import picocli.CommandLine.Help.Ansi
|
||||
import picocli.CommandLine.Option
|
||||
@ -102,6 +104,7 @@ abstract class CommandBase : Callable<Boolean> {
|
||||
printError("Error: Cannot set verbose and quiet modes at the same time")
|
||||
return false
|
||||
}
|
||||
configureLogging()
|
||||
return try {
|
||||
handleCommand()
|
||||
} catch (exception: Throwable) {
|
||||
@ -110,6 +113,17 @@ abstract class CommandBase : Callable<Boolean> {
|
||||
}
|
||||
}
|
||||
|
||||
private fun configureLogging() {
|
||||
val logLevel = when(level) {
|
||||
Severity.ERROR -> Level.ERROR
|
||||
Severity.WARNING -> Level.WARN
|
||||
Severity.INFORMATIONAL -> Level.INFO
|
||||
Severity.DEBUG -> Level.DEBUG
|
||||
Severity.TRACE -> Level.TRACE
|
||||
}
|
||||
Configurator.setRootLevel(logLevel)
|
||||
}
|
||||
|
||||
protected fun printException(exception: Throwable) = when (exception) {
|
||||
is SandboxClassLoadingException -> {
|
||||
printMessages(exception.messages, exception.classOrigins)
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="info">
|
||||
|
||||
<ThresholdFilter level="info"/>
|
||||
<ThresholdFilter level="trace"/>
|
||||
<Appenders>
|
||||
<!-- Will generate up to 10 log files for a given day. During every rollover it will delete
|
||||
those that are older than 60 days, but keep the most recent 10 GB -->
|
||||
|
@ -12,7 +12,12 @@ enum class Severity(val shortName: String, val precedence: Int, val color: Strin
|
||||
/**
|
||||
* Trace message.
|
||||
*/
|
||||
TRACE("TRACE", 3, null),
|
||||
TRACE("TRACE", 4, null),
|
||||
|
||||
/**
|
||||
* Debug message.
|
||||
*/
|
||||
DEBUG("DEBUG", 3, null),
|
||||
|
||||
/**
|
||||
* Informational message.
|
||||
|
Loading…
Reference in New Issue
Block a user