How to make Camunda engine use standard logging?

1.9k views Asked by At

I started experimenting with Camunda engine and noticed that it bypasses my application's log and writes everything to stdout (or stderr?). How can I make it play nice like every other library?

The application has the following dependencies as far as logging is concerned (in build.gradle):

// Replaced with SLF4j below.  Make sure no libraries pull this as a dependency.
configurations.all {
    exclude group: 'commons-logging'
}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.12'
    compile 'ch.qos.logback:logback-classic:1.1.3'
    // Replaces Apache Commons Logging with SLF4j.
    compile 'org.slf4j:jcl-over-slf4j:1.7.12'
}

So, libraries that log through SLF4j or Commons Logging are fine. But Camunda apparently had to invent yet another wheel...

1

There are 1 answers

1
AudioBubble On BEST ANSWER

Turned out to be not another wheel, but rather java.util.logging. It is possible to redirect that to SLF4j too with the following JAR:

    compile 'org.slf4j:jul-to-slf4j:1.7.12'

This bridge needs to be explicitly installed, however (Java code):

    SLF4JBridgeHandler.removeHandlersForRootLogger ();
    SLF4JBridgeHandler.install ();

And for performance reasons, it is best to include this in Logback configuration:

  <!-- For java.util.logging bridging; important for Camunda! -->
  <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
    <resetJUL>true</resetJUL>
  </contextListener>