Skip to content

feat(LoggingConfigurator): add functionality to create configured log…#5261

Merged
matejk merged 3 commits intomainfrom
5260-config-logger
Mar 24, 2026
Merged

feat(LoggingConfigurator): add functionality to create configured log…#5261
matejk merged 3 commits intomainfrom
5260-config-logger

Conversation

@aleks-f
Copy link
Copy Markdown
Member

@aleks-f aleks-f commented Mar 23, 2026

…gers at runtime 5260

@aleks-f aleks-f requested a review from Copilot March 23, 2026 20:23
@aleks-f aleks-f linked an issue Mar 23, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a LoggingConfigurator::getLogger() API to create/configure loggers on-demand at runtime while avoiding registry name collisions.

Changes:

  • Introduces LoggingConfigurator::getLogger() plus internal collision validation for channels/formatters.
  • Adds three CppUnit tests covering new logger creation, existing logger behavior, and collision skipping.
  • Updates test suite registration to include the new cases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
Util/include/Poco/Util/LoggingConfigurator.h Declares getLogger() and documents collision behavior; adds validateConfiguration() declaration.
Util/src/LoggingConfigurator.cpp Implements getLogger() and validateConfiguration() collision checks.
Util/testsuite/src/LoggingConfiguratorTest.h Adds new test method declarations.
Util/testsuite/src/LoggingConfiguratorTest.cpp Adds new test implementations and registers them in the suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add LoggingRegistry::hasChannel()/hasFormatter() to avoid
  exception-driven control flow in validateConfiguration()
- Use C++17 if-init in getLogger() to eliminate double Logger lookup
- Log warning when configuration is skipped due to name collision
- Add [[nodiscard]] to getLogger() and validateConfiguration()
- Strengthen testGetLoggerCollision to also verify channel type
@matejk matejk merged commit a4a62ba into main Mar 24, 2026
2 of 97 checks passed
@matejk matejk deleted the 5260-config-logger branch March 24, 2026 10:25
matejk added a commit that referenced this pull request Mar 24, 2026
#5261)

* feat(LoggingConfigurator): add functionality to create configured loggers at runtime 5260

* feat(LoggingConfigurator): review fixes #5260

* enh(LoggingConfigurator): review improvements for getLogger()

- Add LoggingRegistry::hasChannel()/hasFormatter() to avoid
  exception-driven control flow in validateConfiguration()
- Use C++17 if-init in getLogger() to eliminate double Logger lookup
- Log warning when configuration is skipped due to name collision
- Add [[nodiscard]] to getLogger() and validateConfiguration()
- Strengthen testGetLoggerCollision to also verify channel type

---------

Co-authored-by: Matej Kenda <matejken@gmail.com>
@matejk matejk added this to the Release 1.15.1 milestone Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow creation of loggers with configuration at runtime

3 participants