Hello comrades!
What happens if I set Spring Boot in an application logging.level.root=TRACE
?
All logs will be written to a single file, in which there will be a bunch of small classes.
In the best case, with the help sifting appender
you can divide a maximum of 1 criterion ("discriminator") - for example, by the name of the stream or by the name of the class. And even so - there will be recordability from the source code, which should support the discriminator values ββin "MDC".
Stop, stop, stop! We remove logback
, add
, and with this simple configuration we write in separate log files for each class and level of logging - and even in separate directories:
Bobbin.yml
destinations:
- name: io.infinite.bobbin.config.FileDestinationConfig
fileName: ("./LOGS/INFINITE/${className}/${level}/${className}_${level}_${date}.log")
And this is what happens:

Now imagine that you are asking SRE a colleague:
- org.visa.api.Transfer
- ?
- ERROR
- ! .
Of course, conceptually everything rushes towards ELK (well, either splunk or grafana). But it is not always configured everywhere - and the good old log files are still quite often relevant.
But we believe that we need to go from private to general - being able to do such tricks as above
will give odds to any logger in the cloud. After all, everything depends on the flexibility and ease of configuration.
We recorded a video demonstrating this example in full, and showing how it works
in dynamics:
Enjoy watching!
: Java 8 11, Gradle
( β !). , 2020
. logback
log4j2
. API β , Google Flogger
.
β Gradle Maven .
β Open Source .
.
!