Jakarta Commons Logging

  • A logging façade with autodetection of logging backend
  • Legacy (Unmaintained since 2014, project dead)
  • Very popular (it is the default library used by Spring Framework)
  • Can be replaced by the jcl-over-slf4j adapter

Sample code

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Log log = LogFactory.getLog(CLASS.class);
log.info("Some message");

The Spring Framework logging

  • It's the logging library used by Spring (see reference)
  • But it's excluded by default using Spring Platform!
  • To use slf4j you need exclude commons-logging from spring-core and include the jcl-over-slf4j adapter
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>4.2.5.RELEASE</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.5.8</version>
    </dependency>

results matching ""

    No results matching ""