Blobinspector: trace level logging with --verbose (#3313)

This commit is contained in:
Shams Asari 2018-06-06 13:19:18 +01:00 committed by GitHub
parent 5f2c3d175d
commit 6a2e50b730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -4,7 +4,8 @@ apply plugin: 'kotlin'
dependencies { dependencies {
compile project(':client:jackson') compile project(':client:jackson')
compile 'info.picocli:picocli:3.0.0' compile 'info.picocli:picocli:3.0.0'
compile "org.slf4j:slf4j-nop:$slf4j_version" compile "org.slf4j:jul-to-slf4j:$slf4j_version"
compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
compile "com.jcabi:jcabi-manifests:$jcabi_manifests_version" compile "com.jcabi:jcabi-manifests:$jcabi_manifests_version"
testCompile project(':test-utils') testCompile project(':test-utils')

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonFactory
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import com.jcabi.manifests.Manifests import com.jcabi.manifests.Manifests
import net.corda.client.jackson.JacksonSupport import net.corda.client.jackson.JacksonSupport
import net.corda.core.internal.isRegularFile
import net.corda.core.internal.rootMessage import net.corda.core.internal.rootMessage
import net.corda.core.serialization.SerializationContext import net.corda.core.serialization.SerializationContext
import net.corda.core.serialization.deserialize import net.corda.core.serialization.deserialize
@ -63,6 +64,8 @@ class Main : Runnable {
var verbose: Boolean = false var verbose: Boolean = false
override fun run() { override fun run() {
System.setProperty("logLevel", if (verbose) "trace" else "off")
val bytes = source!!.readBytes().run { val bytes = source!!.readBytes().run {
require(size > amqpMagic.size) { "Insufficient bytes for AMQP blob" } require(size > amqpMagic.size) { "Insufficient bytes for AMQP blob" }
sequence() sequence()
@ -74,6 +77,8 @@ class Main : Runnable {
val envelope = DeserializationInput.getEnvelope(bytes) val envelope = DeserializationInput.getEnvelope(bytes)
println(envelope.schema) println(envelope.schema)
println() println()
println(envelope.transformsSchema)
println()
} }
initialiseSerialization() initialiseSerialization()
@ -112,7 +117,9 @@ private class SourceConverter : ITypeConverter<URL> {
return try { return try {
URL(value) URL(value)
} catch (e: MalformedURLException) { } catch (e: MalformedURLException) {
Paths.get(value).toUri().toURL() val path = Paths.get(value)
require(path.isRegularFile()) { "$path is not a file" }
path.toUri().toURL()
} }
} }
} }

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT" ignoreExceptions="false">
<PatternLayout pattern="[%C{1}.%M] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="${sys:logLevel}">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>