Logger
Emil Forslund edited this page Oct 20, 2016
·
2 revisions
An lightweight logging framework inspired by Tengil.
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);
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>
Speedment is available under the Apache 2 license.
Want to learn more about the enterprise version? Visit www.speedment.com!