ppkarwasz commented on issue #3173:
URL: 
https://github.com/apache/logging-log4j2/issues/3173#issuecomment-2457062120

   @JWT007,
   
   Thank you for stress-testing the `DefaultMergeStrategy`. I is a publicized, 
but not commonly used feature of Log4j Core.
   
   > If I am not mistaken, there is a step missing to add the children of the 
'sourceChildNode' to the new node.
   
   It appears so. In general the class lacks some helper methods that would 
make the code easier to read, like `cloneNode`, `getChildByName`, 
`isAssignableFrom` and so on.
   
   > In addition, the current code does not account for the possibilty of the 
`sourceChildNode` being a `CompositeFilter` which would result in nested 
composite-filters. (this applies to both the `if` and `else` branches of the 
original code).
   
   Filter composition is probably something that should be discussed 
separately, you can post a thread on the [`dev@logging` mailing 
list](https://logging.apache.org/support.html#discussions-maintainer) about it.
   The filtering three-valued logic is a little bit _ad hoc_ and I am not sure 
you can get a reasonable result by just appending the filters from multiple 
configurations.
   
   Some initial thoughts:
   
   - If there is a filter that never returns `NEUTRAL`, it must be **unique** 
and must be the last filter of a pipeline. Users should be able to override 
such a filter.
   - Filters that accept `NEUTRAL` and another result should probably be 
sorted. E.g. first the `ALLOW` filters, then the `DENY` filters.
   
   > The problem I *think* that exists is that the `name` attribute on a 
`Script/ScriptRef/ScriptFile` is _optional_.  So if for whatever reason, 
multiple scripts with no name exist, they will continue to overwrite each other 
during merge so that only the last unnamed script is retained.
   
   Scripts without a name in the global `<Scripts>` container are useless, 
since you can not reference them. They should probably be just removed during 
the merge procedure.
   I also opened #3176 to add some validation code to the `ScriptsPlugin`, so 
that users are warned about such a condition.


-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to