0

I am using Lombok's @Slf4jannotation to get a org.slf4j.Logger instance in my Spring Boot classes like so:

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class Blah {
    public void blupp() {
        log.info("Hi guys.");
    }
}

Because I cannot get hold of the log files easily, I want to provide an API in the application that returns "log temperature" i.e. a count of log messages of severity >= ERROR since last call.

Question: Is there an easy way to extend the Spring Boot / Lombok / Slf4j frameworks with a piece of code that will maintain the map Severity -> Count in memory?

Simulant
  • 19,190
  • 8
  • 63
  • 98
flaschbier
  • 3,910
  • 2
  • 24
  • 36
  • 1
    probably change the question header to say "log statistics" instead of temperature? Seems duplicate of https://stackoverflow.com/questions/45975614/warnings-count-in-slf4j – Abe Aug 04 '20 at 14:23
  • I was thinking that "log temperature" is a carved term but this does not seem to be the case. Thanks for the hint :) – flaschbier Aug 04 '20 at 14:28
  • This is no duplicate of the question linked above because I am asking specifically for Slf4j. – flaschbier Sep 19 '20 at 13:01

0 Answers0