JWT007 commented on issue #3368:
URL:
https://github.com/apache/logging-log4j2/issues/3368#issuecomment-2579555721
Hi @vy ,
as I mentioned, we have a few things going on.
Here I will try and provide some rough details but it is not "relevant" to
this ticket directly.
1. we are using a CompositeConfigurration - we have a sort of framework
based on WAR overlays and our distribution can be extended in projects -
including the Log4j configuration. (So some XML comes from the WARs
(read-only), some is dynamic (no XML), and finally the last is quasi the
"editable" external-configuration).
2. In our CompositeConfiguration hierarchy, we have a runtime-only (no XML)
configuration which generates service-appenders/loggers on-the-fly if a service
is added/removed.
3. We need to present the original configuration (as-is) to our client UI -
which we cannot extract from a constructed Configuration object - hidden
fields, converted attributes, etc. We also need to provide the merged view -
i.e. performing the DefaultMergeStrategy behaviour on the "XML" configuration
instead of the runtime configuration.
---
I am a big fan of fluent APIs - the ConfigurationBuilder is OK but unwieldy
for a lot of content or for dynamic changes.
Also, it doesn't really document the behaviour very well in some cases:
For example, this will throw NPEs (trying to represent an undefined
onResult/onMismatchResult).
```
var filterBuilder =
configBuilder.newFilter("BurstFilter",
(Filter.Result) null,
(Filter.Result) null);
```
...but this will probably not - (but it will put null attrribute values in
the backing map - don't know if that causes problems downstream):
```
var filterBuilder =
configBuilder.newFilter("BurstFilter",
(String) null,
(String) null);
```
Of course, this would be easier if I could take any configuration X and use
it to re-generate the XML representation at runtime - but that unfortunately is
not possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]