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

Fix default enabled debug output during realm-sync-tests #6234

Merged
merged 4 commits into from
Jan 25, 2023

Conversation

michael-wb
Copy link
Contributor

@michael-wb michael-wb commented Jan 25, 2023

What, How & Why?

When the log level threshold was updated to be atomic, the IntraTestLogger was updated to provide its own log level threshold, but this value was not being used properly by subsequent loggers that were linked to this object. An instance of the IntraTestLogger is used by each of the test threads in a unit test run to prevent changes in one thread from affecting the other threads, but they all print out using a single root logger (protected by a ThreadSafeLogger) that is created when the test is started.

Fix the level threshold in the IntraTestLogger so it has its own atomic log level threshold that is used by linked loggers.

Fixes #6233

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • [ ] C-API, if public C++ API changed.

@michael-wb michael-wb requested review from ironage and jbreams January 25, 2023 16:37
@@ -413,29 +413,22 @@ class WildcardFilter : public Filter {
class IntraTestLogger : public Logger {
public:
// Logger with a local log level used for the different test threads
// A new log level threshold atomic will be used for this logger, but
// it will write to the base_logger_ptr when do_log() is called
IntraTestLogger(const std::shared_ptr<Logger>& base_logger_ptr, Level threshold)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you write a real quick little test that instantiates an IntraTestLogger at like trace or debug level and then verify that it actually respects that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test, but I needed to move the IntraTestLogger to logger.hpp - I renamed the class to LocalThresholdLogger

Copy link
Contributor

@ironage ironage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@michael-wb michael-wb merged commit 30a9506 into master Jan 25, 2023
@michael-wb michael-wb deleted the mwb/fix-sync-tests-logging branch January 25, 2023 19:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

info logging is enabled by default in realm-sync-tests
3 participants