[ https://jira.qos.ch/browse/SLF4J-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18219#comment-18219 ]
Hervé Boutemy commented on SLF4J-389: ------------------------------------- Hi Ceki, Thanks for your attention: in fact, after doing this, I thought I could contribute a patch that would be useful for others. But here is what prevented me to do so. Yes, having the 2 methods in Slf4jSimpleLogger could be of help, to drop the patch part: if you can do it, it can help a little bit, since I'll be able to remove the Groovy script But I think this won't avoid us to create a separate slf4j maven-slf4j-provider artifact that shades original slf4j-simple-provider, since we can't have 2 slf4j provider artifacts in one classpath without having a conclict. IIUC, to just have a little Maven extension on top of original slf4j-simple-provider, there is a configuration/extension layer that has to be in place: it's more than the simple addition of these 2 methods. IIUC, this configuration/extension layer is one of the features that is available into gossip provider: if slf4j-simple can add such a feature, yes, it would avoid Maven to create this specific shaded artifact, but slf4j-simple would be less simple, which AFAIK is not really your strategy > SimpleLogger caches System.err and System.out > --------------------------------------------- > > Key: SLF4J-389 > URL: https://jira.qos.ch/browse/SLF4J-389 > Project: SLF4J > Issue Type: Bug > Affects Versions: 1.7.x > Reporter: Igor Polevoy > Assignee: Ceki Gülcü > Fix For: 1.7.23 > > > We usually use SimpleLogger in tests, and some other binding when running in > production. > In some cases, our tests depend on log values logged through the logger > during a test. > Unfortunately between version 1.7.0 and 1.7.1 this ability has been removed, > since the SimpleLogger now caches the system stream in a static initialiser. > Here is the code that broke this approach: > https://github.com/qos-ch/slf4j/commit/996ccc7ca507994465c069554954ecb01890d4d5 > Basically, we would write a test: > {quote}PrintStream err = System.err; > PrintStream temp = new PrintStream(some buffer here); > System.err = temp; > // run tests > System.err = err; > // here we assert that the temp stream contains values we expect{quote} > Unfortunately SimpleLogger now caches the system stream and never releases > it, meaning swapping the streams to catch the output is not possible. -- This message was sent by Atlassian JIRA (v7.3.1#73012) _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev