[logback-user] Is there a Junit appender?
ceki at qos.ch
Wed Apr 28 21:31:02 CEST 2010
On 28/04/2010 9:10 PM, Chris Helck wrote:
> Thanks, this seems to be what I'm looking for, but I'm having a few problems.
> 1. I've checked the source code and I only see ListAppender being used in AppenderTrackerTest and StringListAppender. You said it's is used extensively, am I missing something?
You should also look in logback-classic not just logback-core.
> 2. Below is my code. It seems to work, but now the tests are echo'ing all log messages to stdout. Prior to this change the messages were going to SLF4j's NOP binding. I suspect this is because the Logback classic jar is on the classpath and is getting picked up. Long story short, I don't want log messages echo'd to stdout when running tests. Any ideas?
That's the default logback configuration kicking in. You can either
create a LoggingContext per unit test, which is what logback's own unit
tests do, or reset the default logger context, the one returned by
LoggerFactory. Here is the code to reset the default logger context.
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
More information about the Logback-user