Start mock appender for capturing logger
The base test case class has been adapted to assert that no warn nor error messages are logged to the Log4j status logger. An issue that exists in x-pack uncovered by this change is that the mock appender in the capturing logger was never started. This commit addresses this issue. Relates elastic/elasticsearch#3988 Original commit: elastic/x-pack-elasticsearch@8fc0b99bae
This commit is contained in:
parent
ae960f976d
commit
4e0457276d
|
@ -27,7 +27,9 @@ public class CapturingLogger {
|
||||||
final String name = caller.getClassName() + "." + caller.getMethodName() + "." + level.toString();
|
final String name = caller.getClassName() + "." + caller.getMethodName() + "." + level.toString();
|
||||||
final Logger logger = ESLoggerFactory.getLogger(name);
|
final Logger logger = ESLoggerFactory.getLogger(name);
|
||||||
Loggers.setLevel(logger, level);
|
Loggers.setLevel(logger, level);
|
||||||
Loggers.addAppender(logger, new MockAppender(name));
|
final MockAppender appender = new MockAppender(name);
|
||||||
|
appender.start();
|
||||||
|
Loggers.addAppender(logger, appender);
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue