如何使Camunda发动机使用标准记录?

时间:2015-06-10 10:45:00

标签: logging camunda

我开始尝试使用Camunda引擎并注意到它绕过我的应用程序日志并将所有内容写入stdout(或stderr?)。我怎样才能让它像其他图书馆一样好玩?

就日志记录而言,应用程序具有以下依赖关系(在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'
}

因此,通过SLF4j或Commons Logging登录的库很好。但是Camunda显然不得不发明另一个轮子......

1 个答案:

答案 0 :(得分:0)

原来不是另一个轮子,而是java.util.logging。也可以使用以下JAR将其重定向到SLF4j:

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

需要显式安装此桥接器(Java代码):

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

出于性能原因,最好将其包含在Logback配置中:

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