Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve LoggerUtils support and add TestLoggerExtension #3123

Merged
merged 8 commits into from Aug 1, 2022

Conversation

simonbasle
Copy link
Member

@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

@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.

None yet

3 participants