Skip to content

Improve LoggerUtils support and add TestLoggerExtension#3123

Merged
simonbasle merged 8 commits into3.4.xfrom
loggerUtilsAndParamResolver
Aug 1, 2022
Merged

Improve LoggerUtils support and add TestLoggerExtension#3123
simonbasle merged 8 commits into3.4.xfrom
loggerUtilsAndParamResolver

Conversation

@simonbasle
Copy link
Copy Markdown
Contributor

@simonbasle simonbasle commented Jul 22, 2022

This PR improves LoggerUtils and adds supporting JUnit5 annotations in reactor-core tests:

LoggerUtils now has support to redirect rather than copy/capture log messages when the
logger factory is installed early.

In reactor-core tests, a TestLoggerExtension is added that sets up a TestLogger and activates capture/redirection via LoggerUtils:

  • before the test, it creates a TestLogger (configured depending on test annotations) and
    sets up LoggerUtils with said TestLogger
  • as a ParameterResolver it injects the TestLogger into the test case
  • after the test it disableCapture()

The Extension should be applied to individual tests. Convenience annotations are provided that fine tune the TestLogger that will be injected:

  • @Capture should the loggers capture log output, ie. go both to original logger and TestLogger
  • @Redirect should the loggers redirect log output, ie. only go to TestLogger

@simonbasle simonbasle marked this pull request as ready for review July 22, 2022 15:07
@simonbasle simonbasle requested a review from a team as a code owner July 22, 2022 15:07
@simonbasle simonbasle added the area/reactor-test This belongs to the reactor-test module label Jul 22, 2022
@simonbasle simonbasle added this to the 3.4.22 milestone Jul 22, 2022
@reactorbot
Copy link
Copy Markdown

@simonbasle this PR seems to have been merged on a maintenance branch, please ensure the change is merge-forwarded to intermediate maintenance branches and up to main 🙇

@simonbasle simonbasle deleted the loggerUtilsAndParamResolver branch August 1, 2022 14:12
simonbasle added a commit that referenced this pull request Aug 1, 2022
@simonbasle simonbasle added the type/enhancement A general enhancement label Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/reactor-test This belongs to the reactor-test module type/enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants