capture logs in a test

I'm trying to capture bean allocation logs in a test - I've got code that I've tested, and will successfully capture logs from my classes - but when I try to do it on spring classes it is seemingly not working - here is the code I use to try and capture:

LoggerContext context = (LoggerContext) (LoggerFactory.getILoggerFactory());

Logger log = context.getLogger("");


MyAppender appender = new MyAppender();

appender.setContext( context);

log.addAppender( appender );

SpringApplication newApplication = new SpringApplication( Application.class); new String [] {});

Now if I trace in and look at the logger that spring is using - it...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts