com.github.sdegroot:logback-context-logbuffer

Buffer logs until a certain level-threshold

License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.github.sdegroot
ArtifactId

ArtifactId

logback-context-logbuffer
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

com.github.sdegroot:logback-context-logbuffer
Buffer logs until a certain level-threshold
Source Code Management

Source Code Management

https://github.com/sdegroot/logback-context-logbuffer

Download logback-context-logbuffer

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.sdegroot/logback-context-logbuffer/ -->
<dependency>
    <groupId>com.github.sdegroot</groupId>
    <artifactId>logback-context-logbuffer</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.sdegroot/logback-context-logbuffer/
implementation 'com.github.sdegroot:logback-context-logbuffer:0.0.1'
// https://jarcasting.com/artifacts/com.github.sdegroot/logback-context-logbuffer/
implementation ("com.github.sdegroot:logback-context-logbuffer:0.0.1")
'com.github.sdegroot:logback-context-logbuffer:jar:0.0.1'
<dependency org="com.github.sdegroot" name="logback-context-logbuffer" rev="0.0.1">
  <artifact name="logback-context-logbuffer" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.sdegroot', module='logback-context-logbuffer', version='0.0.1')
)
libraryDependencies += "com.github.sdegroot" % "logback-context-logbuffer" % "0.0.1"
[com.github.sdegroot/logback-context-logbuffer "0.0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.commons : commons-collections4 jar 4.1
org.projectlombok : lombok jar 1.16.4

provided (2)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.12
ch.qos.logback : logback-classic jar 1.1.3

test (5)

Group / Artifact Type Version
junit : junit jar 4.10
org.mockito : mockito-core jar 1.10.19
org.hamcrest : hamcrest-core jar 1.3
org.hamcrest : hamcrest-junit jar 2.0.0.0
org.apache.commons : commons-lang3 jar 3.4

Project Modules

There are no modules declared in this project.

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

Versions

Version
0.0.1