Skip to content
Emil Forslund edited this page Oct 20, 2016 · 2 revisions

Speedment - Common - Logger

An lightweight logging framework inspired by Tengil.

Example Usage

This is a basic usage example:

public class MyClass {
    private final static Logger LOGGER = LoggerManager.getLogger(MyClass.class);

    public void myMethod() {
        LOGGER.info("This is just some info.");
        LOGGER.warn("This is a serious warning.");
        LOGGER.debug("This can be important for debugging.");
        LOGGER.error("Something bad has happened.");
    }
}

To log error messages caused by exceptions:

try {
    someDangerousMethod();
} catch (final Exception ex) {
    LOGGER.error(ex, "Something really bad happened.");
}

To show debug messages in the log:

LoggerManager.getLogger(MyClass.class).setLevel(Level.DEBUG);

Install

To use Logger in your own projects, add the following to your pom.xml-file:

<dependency>
    <groupId>com.speedment.common</groupId>
    <artifactId>logger</artifactId>
    <version>1.0.2</version>
</dependency>