mirror of
https://github.com/corda/corda.git
synced 2024-12-30 01:39:04 +00:00
Corda-1155 - Jolokia logging via slf4j (#2753)
* Jolokia logging through slf4j * review remarks
This commit is contained in:
parent
4e5df2f4fb
commit
803ce15b32
@ -60,5 +60,9 @@
|
|||||||
<Logger name="org.apache.activemq.artemis.core.server" level="error" additivity="false">
|
<Logger name="org.apache.activemq.artemis.core.server" level="error" additivity="false">
|
||||||
<AppenderRef ref="RollingFile-Appender"/>
|
<AppenderRef ref="RollingFile-Appender"/>
|
||||||
</Logger>
|
</Logger>
|
||||||
|
<Logger name="org.jolokia" additivity="true" level="warn">
|
||||||
|
<AppenderRef ref="Console-Appender-Println"/>
|
||||||
|
<AppenderRef ref="RollingFile-Appender" />
|
||||||
|
</Logger>
|
||||||
</Loggers>
|
</Loggers>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
@ -175,7 +175,8 @@ dependencies {
|
|||||||
testCompile "org.glassfish.jersey.containers:jersey-container-servlet-core:${jersey_version}"
|
testCompile "org.glassfish.jersey.containers:jersey-container-servlet-core:${jersey_version}"
|
||||||
testCompile "org.glassfish.jersey.containers:jersey-container-jetty-http:${jersey_version}"
|
testCompile "org.glassfish.jersey.containers:jersey-container-jetty-http:${jersey_version}"
|
||||||
|
|
||||||
runtime "org.jolokia:jolokia-jvm:${jolokia_version}:agent"
|
// Jolokia JVM monitoring agent
|
||||||
|
compile "org.jolokia:jolokia-jvm:${jolokia_version}:agent"
|
||||||
}
|
}
|
||||||
|
|
||||||
task integrationTest(type: Test) {
|
task integrationTest(type: Test) {
|
||||||
|
40
node/src/main/kotlin/net/corda/node/JolokiaSlf4Adapter.kt
Normal file
40
node/src/main/kotlin/net/corda/node/JolokiaSlf4Adapter.kt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package net.corda.node
|
||||||
|
|
||||||
|
import org.jolokia.util.LogHandler
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This also exists in webserver, because depends on jolokia
|
||||||
|
**/
|
||||||
|
class JolokiaSlf4Adapter : LogHandler {
|
||||||
|
companion object {
|
||||||
|
val log: Logger = LoggerFactory.getLogger("org.jolokia")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun error(message: String?, t: Throwable?) {
|
||||||
|
if (message != null) {
|
||||||
|
if (t != null) {
|
||||||
|
log.error(message, t)
|
||||||
|
} else {
|
||||||
|
log.error(message)
|
||||||
|
}
|
||||||
|
} else if (t != null) {
|
||||||
|
log.error("Exception without a comment", t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun debug(message: String?) {
|
||||||
|
if (message != null) {
|
||||||
|
log.debug(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun info(message: String?) {
|
||||||
|
if (message != null) {
|
||||||
|
log.info(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -25,5 +25,9 @@
|
|||||||
<Logger name="org.hibernate.SQL" level="info" additivity="false">
|
<Logger name="org.hibernate.SQL" level="info" additivity="false">
|
||||||
<AppenderRef ref="Console-Appender"/>
|
<AppenderRef ref="Console-Appender"/>
|
||||||
</Logger>
|
</Logger>
|
||||||
|
<Logger name="org.jolokia" additivity="true" level="warn">
|
||||||
|
<AppenderRef ref="Console-Appender-Println"/>
|
||||||
|
<AppenderRef ref="RollingFile-Appender" />
|
||||||
|
</Logger>
|
||||||
</Loggers>
|
</Loggers>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package net.corda.webserver
|
||||||
|
|
||||||
|
import org.jolokia.util.LogHandler
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This also exists in node, because depends on jolokia
|
||||||
|
**/
|
||||||
|
class JolokiaSlf4Adapter : LogHandler {
|
||||||
|
companion object {
|
||||||
|
val log: Logger = LoggerFactory.getLogger("org.jolokia")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun error(message: String?, t: Throwable?) {
|
||||||
|
if (message != null) {
|
||||||
|
if (t != null) {
|
||||||
|
log.error(message, t)
|
||||||
|
} else {
|
||||||
|
log.error(message)
|
||||||
|
}
|
||||||
|
} else if (t != null) {
|
||||||
|
log.error("Exception without a comment", t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun debug(message: String?) {
|
||||||
|
if (message != null) {
|
||||||
|
log.debug(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun info(message: String?) {
|
||||||
|
if (message != null) {
|
||||||
|
log.info(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user