Inspect the contents of log output during unit test (no mock used)
See Sample Code for the detailed method.
In theory,
of ʻAppender
to be added, and ʻadd () ʻadd ()
the ʻILoggingEvent` received as an argument to the list of the external scope.The flow.
Note that if you leave Appender added to the root logger and do not detach it, you will retain logging for all subsequent tests.
I wrote it on the assumption that it will be added to the root logger, but if you specify the logger in detail (like getLogger ("jp.co.hoge ")
) and add ʻAppender` there, only that part will be logged. It is also possible.
Recommended Posts