logging - With jul-to-slf4j WildFly logs unformatted messages -
our application runs in wildfly, use custom logging, in jboss-deployment-structure.xml
there these lines:
<exclude-subsystems> <subsystem name="logging"/> </exclude-subsystems>
we use slf4j logback backend, project dependencies (in gradle format) include these:
compile 'org.slf4j:slf4j-api:1.7.12' compile 'ch.qos.logback:logback-classic:1.1.3' compile 'org.slf4j:jcl-over-slf4j:1.7.12'
recently added library uses java.util.logging
, not slf4j, logs go stdout. solve this, added dependency:
compile 'org.slf4j:jul-to-slf4j:1.7.12'
and added following 2 lines of java code application initialization code:
slf4jbridgehandler.removehandlersforrootlogger (); slf4jbridgehandler.install ();
now library logs fine.
but, problem appeared: wildfly messages written our log (seems uses java.util.logging). not bad (even if prefer application , webserver logs separated), come along non-formatted, unconverted placeholders. e.g. before jul-to-slf4j
addition wildfly log message:
[...] ut005023: exception handling request /main.html
but instead see this:
[...] ut005023: exception handling request %s
do need add configuration jul-to-slf4j
can format messages? or there fundamental limitation handling messages parameters?
hmmm... looks wildfly (certainly version 8+) uses jboss logging. jboss logging far can tell logging wrapper.
it must configured push on jul.
from reading of source code looks supports pushing onto slf4j well...
so should investigate how tell jboss logging in wildfly log slf4j.
Comments
Post a Comment