Skip to content

Instantly share code, notes, and snippets.

@relax-more
Created September 2, 2015 08:52
Show Gist options
  • Save relax-more/7a47798b9fcdad74ce9c to your computer and use it in GitHub Desktop.
Save relax-more/7a47798b9fcdad74ce9c to your computer and use it in GitHub Desktop.
Loggable annotation
http://aspects.jcabi.com/apidocs-0.22/com/jcabi/aspects/Loggable.html
Can just add @Loggable to private methods that we want to log.
I tried it out and got output like this
something
16:02:43.085 [Test worker] INFO c.l.s.c.aspects.impl.TimedAspectTest - #doSomething(): in 1.30ms
something
16:02:43.086 [Test worker] INFO c.l.s.c.aspects.impl.TimedAspectTest - #doSomething(): in 121.78µs
for maven, I think you add this
<project>
<build>
<plugins>
<plugin>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-maven-plugin</artifactId>
<version>0.13.2</version>
<executions>
<execution>
<goals>
<goal>ajc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
and
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
<version>0.22</version>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment