Bug 995133 - jBPM should use 1 logging system (and standarize on slf4j with logback)
jBPM should use 1 logging system (and standarize on slf4j with logback)
Status: CLOSED CURRENTRELEASE
Product: JBoss BPMS Platform 6
Classification: JBoss
Component: Build and Assembly (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity unspecified
: ER4
: 6.0.0
Assigned To: Geoffrey De Smet
Ivo Bek
:
Depends On:
Blocks: 989519
  Show dependency treegraph
 
Reported: 2013-08-08 11:27 EDT by Geoffrey De Smet
Modified: 2014-08-06 16:12 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 16:12:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Geoffrey De Smet 2013-08-08 11:27:18 EDT
Most modules use slf4j-logback. These don't and need to switch to that too:

jbpm-form-modeler-renderer: commons-logging (compile time even!)
jbpm-designer-backend: slf4j-jdk14 (compile time even!)
jbpm-designer-client: slf4j-jdk14 (compile time even!)
- Note: Many modules that depends on designer exclude logging dependencies because of this
jbpm-distribution: slf4j-log4j12
jbpm-examples: slf4j-log4j12
jbpm-executor: slf4j-log4j12
jbpm-test: slf4j-log4j12
droolsjbpm-bpms-distribution: slf4j-log4j12



HOW TO USE SLF4J AND LOGBACK PROPERLY
=====================================

Use slf4j with logback

Here's how it works:

1) In your java code, use the slf4 interfaces:
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;

Sfl4j is just a very-efficiently logging interface, it doesn't actually log itself.
Make sure you understand that
  logger.trace("Hello {}", username);
is a LOT faster than than
  logger.trace("Hello " + username);
if trace is disabled (which it usually is).

2) Add maven dependencies on slf4j-api and logback-classic:

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope> <!--or <scope>runtime</scope> for examples and wars -->
    </dependency>

Remove/exclude any log4j and slf4j-log4j dependencies.
Note: log4j hasn't seen a release in 5 years. It's dead (and very slow).

3) Add a logback-test.xml file directly under in src/test/resources:
For example:
  https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-examples/src/test/resources/logback-test.xml

4) For end-user jars (so examples and wars, but NOT jbpm-flow etc), add a logback.xml directly under src/main/resources:
For example:
  https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-examples/src/main/resources/logback.xml

Note: If both logback-text.xml and logback.xml are on the classpath, logback will ignore the latter and only use logback-text.xml.
So never put logback-text.xml in a non-test classpath.

5) For more info:
http://www.slf4j.org/manual.html (how to use from code)
http://logback.qos.ch/documentation.html (how to configure it to do what you want it do)
Comment 2 Geoffrey De Smet 2013-08-08 11:30:39 EDT
Blocks https://bugzilla.redhat.com/show_bug.cgi?id=994981
Comment 3 Maciej Swiderski 2013-08-12 10:35:20 EDT
cleaned up jbpm-executor, jbpm-test and jbpm-examples, pushed both to master and 6.0.x branch:
https://github.com/droolsjbpm/jbpm/commit/82bb74193cd8cac40684257b9cfe8ac175d48fc2
Comment 4 Geoffrey De Smet 2013-08-13 11:08:07 EDT
Maciesj has fixed jbpm-executor, jbpm-examples, jbpm-test.
gdesmet has fixed jbpm-distribution

sr_pere is fixing on form-modeler
tihimor is fixing on designer
Comment 5 Geoffrey De Smet 2013-08-16 07:26:42 EDT
pere and tiho have fixed form-modeler and designer too. All fixed now.
Comment 9 Ivo Bek 2013-11-18 08:35:28 EST
Verified.
It's not mentioned but Geoffrey has removed slf4j-log4j12 from droolsjbpm-bpms-distribution https://github.com/droolsjbpm/droolsjbpm-integration/commit/aaeaa8a90e658e0eeda7ae07cdda796a7d6485ab

Note You need to log in before you can comment on or make changes to this bug.