Skip to content

Logback plugin that allows to buffer logs messages until the loglevel of a log messages surpasses the set threshold

License

Notifications You must be signed in to change notification settings

sdegroot/logback-context-logbuffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Maven Central

logback-context-logbuffer

Logback plugin that allows to buffer logs messages until the loglevel of a log messages surpasses the set threshold

The problem

Logging is crucial for any system. It serves many purposes but one of the main purposes of general application logging is to help understand cases where something went wrong.

In the world of logging we use different levels of logging. Examples are DEBUG, INFO, WARN and ERROR. Each of them serves a purpose but in general the lower the level, the more information you will get.

It is a common struggle for developers and operations to determine what the log level should be. One the one hand you want to have DEBUG information available for the problem cases. However, on the other side you don't want the system to log everything on DEBUG level as results into enormous amounts of logs.

This tool provides a solution for this problem. Instead of of having to make the choice for a static log level, the logback-context-logbuffer will only print DEBUG logging in cases where something went wrong.

How it works

The logback-context-logbuffer works by creating an internal fifo-buffer of a configurable amount of log messages.

It will keep all log messages of all levels (as configured in logback.xml) in this buffer. As soon as it receives a log message of a certain level (typically WARN/ERROR) it will flush it's buffer to the appender.

Supported appenders

  1. ConsoleAppender
  2. RollingFileAppender

Other appenders are not yet supported. Please feel free to create a pull request.

Common pitfalls

  • You have set the log level to DEBUG in logback

For a working example see the examples directory.

References

About

Logback plugin that allows to buffer logs messages until the loglevel of a log messages surpasses the set threshold

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages