[slf4j-dev] [JIRA] Updates for SLF4J-592: Programmatically specify fallback provider for unit tests.

slf4j developers list slf4j-dev at qos.ch
Wed Jun 21 17:55:00 CEST 2023


SLF4J / SLF4J-592 [Open]
Programmatically specify fallback provider for unit tests.

==============================

Here's what changed in this issue in the last few minutes.


There is 1 comment.


View or comment on issue using this link
https://jira.qos.ch/browse/SLF4J-592

==============================
 1 comment
------------------------------

Garret Wilson on 21/Jun/23 17:43

The more I think about this, the more I'm inclined to think that what we really need is a way to declare a logging provider for tests that would not only serve as a fallback, it would actually _override_ the main logger if any. Because if my main application has some intricate logging defined via a Logback configuration file (e.g. logging to a file and or sending to some log aggregation service), I don't want that logger to be in effect when I run unit tests.

One might say "well just define the {{slf4j-simple}} logger with scope {{test}} for your libraries, and for your application only define the application logger". There are two problems:

* I'm using the same parent POM for both my libraries and my applications, and it sets {{slf4j-simple}} logger with scope {{test}}.
* Even if I didn't use the same parent POM for both my libraries and my applications, there are many parts of the application I want to test for which I don't want the entire application logging configured during the running of unit tests.


==============================
 This message was sent by Atlassian Jira (v9.6.0#960000-sha1:a3ee8af)



More information about the slf4j-dev mailing list