Logger Spring Boot Save

A Spring Boot @Loggable annotation that will help you log your application more easily

Project README

Spring Boot Logger

A Spring Boot @Loggable annotation that will help you log your application more easily.

Base on jcabi-aspects project @Loggable annotation.

Build Status Coverage Status

Maven Central Sonatype Nexus (Snapshots)



Register the Logger to your Spring Boot application and allow it to log wherever you tell it to. The Logger uses the slf4j to support abstraction for various logging frameworks.


In order to add logger to your project simply add this dependency to your classpath:

compile 'com.github.rozidan:logger-spring-boot:1.1.0'

For snapshots versions add the sonatype public repository:

repositories {
    maven { url "https://oss.sonatype.org/content/groups/public" }

Log your application

Apply the Logger to your application with @EnableLogger annotation in a configuration class:

public class LoggerConfig {


Simply add the @Loggable annotation to a method, or to a class scope:

@RequestMapping(path = "/employees")
public class EmployeeController {
	public List<EmployeeDto> listAllEmployees() {

More examples:

Warning whenever execution is over 2 sec:

@Loggable(warnOver = 2, warnUnit = TimeUnit.SECONDS)

This will result 2 lines of log, one where 2 sec are over, and the other when execution is complete:

.....c.i.s.l.w.c.EmployeeController           : #listAllEmployees([]): in PT2.833S and still running (max PT0.002S)
.....c.i.s.l.w.c.EmployeeController           : #listAllEmployees([]): [] in PT6.345S (max PT0.002S)

Log when enter to a method:

@Loggable(entered = true)

Skip printing arguments and results of a method:

@Loggable(skipArgs = true, skipResult = true)

Log with different level (default is INFO):


Set a different logger name (default is class name):

@Loggable(value = LogLevel.WARN, name = "my-logger-name")



Open Source Agenda is not affiliated with "Logger Spring Boot" Project. README Source: rozidan/logger-spring-boot
Open Issues
Last Commit
3 years ago

Open Source Agenda Badge

Open Source Agenda Rating