[
https://issues.apache.org/jira/browse/LOG4J2-3693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jeff Thomas updated LOG4J2-3693:
--------------------------------
Description:
The XmlConfiguration implementation is non-final meaning it is possible to
subclass it to provide additional custom functionality; however: the most
relevant class field `rootElement` is _private_ making it near impossible to do
anything useful in the subclass.
It would be helpful (and prevent making a complete copy of the implementation)
to at the very least provide a protected accessor for this field:
i.e. `protected Element getRootElement()`
This way, a custom subclass has a chance to perform some custom handling in
`public void setup()` before the hierarchy is constructed.
Most of the AbstractConfiguration configuration-relevant fields are protected
(i.e. rootNode) - but it seems someone didn't stick to that approach in the
XmlConfiguration implementation.
was:
The XmlConfiguration implementation is non-final meaning it is possible to
subclass it to provide additional custom functionality; however: the mostt
relevant class field `rootElement` is _private_ making it near impossible to do
anything useful in the subclass.
It would be helpful (and prevent making a complete copy of the implementation)
to at the very least provide a protected accessor for this field:
i.e. `protected Element getRootElement()`
This way, a custom subclass has a chance to perform some custom handling in
`public void setup()` before the hierarchy is constructed.
Most of the AbstractConfiguration configuration-relevant fields are protected
(i.e. rootNode) - but it seems someone didn't stick to that approach in the
XmlConfiguration implementation.
> XmlConfiguration keeps relevant fields private without providing protected
> accessors making subclassing difficult
> -----------------------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-3693
> URL: https://issues.apache.org/jira/browse/LOG4J2-3693
> Project: Log4j 2
> Issue Type: Improvement
> Components: API, Configuration
> Affects Versions: 2.24.0
> Reporter: Jeff Thomas
> Priority: Major
>
> The XmlConfiguration implementation is non-final meaning it is possible to
> subclass it to provide additional custom functionality; however: the most
> relevant class field `rootElement` is _private_ making it near impossible to
> do anything useful in the subclass.
> It would be helpful (and prevent making a complete copy of the
> implementation) to at the very least provide a protected accessor for this
> field:
> i.e. `protected Element getRootElement()`
> This way, a custom subclass has a chance to perform some custom handling in
> `public void setup()` before the hierarchy is constructed.
> Most of the AbstractConfiguration configuration-relevant fields are protected
> (i.e. rootNode) - but it seems someone didn't stick to that approach in the
> XmlConfiguration implementation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)