• 0.22.6

Logging Exceptions Thrown out of Java Methods

Annotate your methods with @LogExceptions. Annotation and every exception thrown out of the method will be logged through SLF4J:

public class Resource {
  @LogExceptions
  public String load(URL url) {
    return url.openConnection().getContent();
  }
}

If an exception occurs it will be logged through SLF4J logging factility.

Also, take a look at @Loggable. This annotation does the same, but also logs non-exceptional situations.

The mechanism is implemented with AOP/AspectJ. Read how to integrate it into your pom.xml.