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

Bugfix/log4 j 3441 #3451

Closed
wants to merge 3 commits into from
Closed

Bugfix/log4 j 3441 #3451

wants to merge 3 commits into from

Conversation

JWT007
Copy link
Contributor

@JWT007 JWT007 commented Feb 10, 2025

Improve on extensibility of BuiltConfiguration/DefaultConfigurationBuilder

ConfigurationBuilder interface:

  • added convenience methods to ConfigurationBuilder interface (to better sync with existing methods)
  • annotated as @ProviderType (see ticket)

DefaultConfigurationBuilder

  • removed fields for configuration attributtes - they are set as atttributes directly on rootComponent instead
  • added a protected generic support method 'getOrCreateComponent' (also for subclasses to use)
  • added methods:
    • public ConfigurationBuilder<T> addProperty(PropertyComponentBuilder)
    • protected Optional<String> getRootProperty(String)
    • protected Optional<Component> getComponent(String)
    • protected Component getOrCreateComponent(String)
    • protected Component getRootComponent()
    • added setMonitorInterval(int) and setShutdownTimeout(long) for direct setting
    • added setMonitorInterval(int, TimeUnit) and setShutdownTimeout(String, TimeUnit) so both methods have a string and a number variant
    • added protected getters for attributes and child components
  • moved initialization from "build(boolean)" to BuiltConfiguration constructor since everything is transported overr the rootComponent now
  • added more argument validation
  • improved javadoc

BuiltConfiguration:

  • removed Component fields (appenders/loggers/etc.) and replaced with protected generic Optional accessors directly from 'rootComponent'
  • attribute processing done in constructor (moved from DefaultConfigurationBuilder#build())
  • added protected accessors (getRootComponent, getChildComponent, and getChildComponents) so subclasses can access the root component
  • guarded int/long conversion for 'monitorInterval' and 'shutdownTimeout'
  • added more argument validation
  • improved javadoc
  • added CustomBuiltConfigurationTest unit-tests
  • updated "revision" in main pom.xml to 2.25.0 due to baseline majorr change to ConfigurationBuilder interface
  • updated package-info.java versions to 2.25.0 in
    • org.apache.logging.log4j.core.config.builder.api
    • org.apache.logging.log4j.core.config.builder.impl
    • org.apache.logging.log4j.core.config.properties
  • fixed bug in UnitTest Configurator1Test where the test configuration was being inittialized twice

NOTE to reviewers - please review carefully due to API changes and specifically:

  • the move of all attributes/components directly onto rootComponent in DefaultConfigurationBuilder
  • the move of initializatiton logic for attributes from DefaultConfigurationBuilder#build to the BuiltConfiguration constructor

@JWT007
Copy link
Contributor Author

JWT007 commented Feb 11, 2025

@ppkarwasz - build failed - but I don't think I can fix it?

Error: This request has been automatically failed because it uses a deprecated version of actions/cache: 0c45773b623bea8c8e75f6c82b208c3cf94ea4f9``

@JWT007
Copy link
Contributor Author

JWT007 commented Mar 1, 2025

cancelling this PR for now - working on other PR that will break this one.

@JWT007 JWT007 closed this Mar 1, 2025
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.

None yet

2 participants