GenericTestUtils$LogCapturer is useful for assertions against service logs. However it should be fixed in following aspects:
- In the constructor, it uses the stdout appender's layout.
Layout layout = Logger.getRootLogger().getAppender("stdout").getLayout();
However, the stdout appender may be named "console" or alike which makes the constructor throw NPE. Actually the layout does not matter and we can use a default pattern layout that only captures application logs.
- stopCapturing() method is not working. The major reason is that the appender internal variable is never assigned and thus removing it to stop capturing makes no sense.
- It does not support org.slf4j.Logger which is preferred to log4j in many modules.
- There is no unit test for it.
This jira is to address these.
- is depended upon by
HADOOP-10823 TestReloadingX509TrustManager is flaky
- is related to
HADOOP-14573 regression: Azure tests which capture logs failing with move to SLF4J