DefaultMergeStrategy - problem merging filters
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
DefaultMergeStrategy#updateFilterNode から始め、issue の XML 設定例を使って 2 つの merge 分岐を比較します。ソースフィルターの子要素が保持されるか、また複合フィルターがネストされるのではなくフラット化されるかを確認します。マージされた設定が、期待される複合構造を持つすべてのフィルターおよび KeyValuePair の子要素を保持していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
DefaultMergeStrategy (Log4j 2.24.1)
In DefaultMergeStrategy#updateFilterNode I think there is a problem when merging two configurations with filters and the target does not yet contain a CompositeFilter. (in the code below this is the elsecase).
private void updateFilterNode(
final Node target,
final Node targetChildNode,
final Node sourceChildNode,
final PluginManager pluginManager) {
if (CompositeFilter.class.isAssignableFrom(targetChildNode.getType().getPluginClass())) {
final Node node = new Node(targetChildNode, sourceChildNode.getName(), sourceChildNode.getType());
node.getChildren().addAll(sourceChildNode.getChildren());
node.getAttributes().putAll(sourceChildNode.getAttributes());
targetChildNode.getChildren().add(node);
} else {
final PluginType pluginType = pluginManager.getPluginType(FILTERS);
final Node filtersNode = new Node(targetChildNode, FILTERS, pluginType);
final Node node = new Node(filtersNode, sourceChildNode.getName(), sourceChildNode.getType());
node.getAttributes().putAll(sourceChildNode.getAttributes());
final List<Node> children = filtersNode.getChildren();
children.add(targetChildNode);
children.add(node);
final List<Node> nodes = target.getChildren();
nodes.remove(targetChildNode);
nodes.add(filtersNode);
}
}
If I am not mistaken, there is a step missing to add the children of the 'sourceChildNode' to the new node.
I think it should be (see line commented with "<==== ADDED").
else {
final PluginType pluginType = pluginManager.getPluginType(FILTERS);
final Node filtersNode = new Node(targetChildNode, FILTERS, pluginType);
final Node node = new Node(filtersNode, sourceChildNode.getName(), sourceChildNode.getType());
node.getChildren().addAll(sourceChildeNode.getChildren()); // <==== ADDED
node.getAttributes().putAll(sourceChildNode.getAttributes());
final List<Node> children = filtersNode.getChildren();
children.add(targetChildNode);
children.add(node);
final List<Node> nodes = target.getChildren();
nodes.remove(targetChildNode);
nodes.add(filtersNode);
}
}
For example if merging a secondary configuration (source) containing the following filter to a base configuration (target) when the target contains a filter (but not a CompositeFilter):
<Configuration>
<DynamicThresholdFilter key="loginId" defaultThreshold="ERROR">
<KeyValuePair key="alice" value="DEBUG"/>
<KeyValuePair key="bob" value="INFO"/>
</DynamicThresholdFilter>
</Configuration>
I believe all the KeyValuePair children would be dropped during merge with the current code.
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 ifand elsebranches of the original code.
<Configuration>
<CompositeFilter>
<Filter1/>
<Filter2/>
</CompositeFilter>
</Configuration>
<Configuration>
<CompositeFilter>
<Filter3/>
<Filter4/>
</CompositeFilter>
</Configuration>
Would result in:
<Configuration>
<CompositeFilter>
<Filter1/>
<Filter2/>
<CompositeFilter>
<Filter3/>
<Filter4/>
</CompositeFilter>
</CompositeFilter>
</Configuration>
But should probably be:
<Configuration>
<CompositeFilter>
<Filter1/>
<Filter2/>
<Filter3/>
<Filter4/>
</CompositeFilter>
</Configuration>
- 主要言語
- Java
- スター
- 3.6k
- フォーク
- 1.8k
- 平均マージ
- 5日 6時間
- マージ済み PR(30日)
- 24
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/logging-log4j2 のほかの issue
-
additivity attributeオープンwaiting-for-maintainer
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
apache/logging-log4j2#4475 ·
メンテナーはふだん 1 日以内に返信
-
Migrate `log4j-api-test` tests to JUnit 5再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンapi priority: P3 tests waiting-for-maintainer
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/logging-log4j2#4430 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`Rfc5424Layout` does not escape the `newLineEscape` replacement in SD-PARAM-VALUE対応中かも @lunarbae628 が 5 日前に担当しました。 オープンbug layouts priority: P3
apache/logging-log4j2#4464 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
configuration enhancement layouts
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
apache/logging-log4j2#4463 ·
メンテナーはふだん 1 日以内に返信
-
`evaluateOnStartup="true"` saves logs under wrong file names after missing scheduled roll再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンappenders:Rolling bug priority: P1 waiting-for-maintainer
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
apache/logging-log4j2#4449 ·
メンテナーはふだん 1 日以内に返信
apache/logging-log4j2 の issue をすべて見る
似ている issue
-
untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
-
Good First Issue
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
hiero-ledger/hiero-sdk-java#3059 ·
メンテナーはふだん 1 日以内に返信
-
bug live-tv platform:desktop platform:mobile platform:tv
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
fk0u/cleanyourtv-tahoe#102 ·
メンテナーはふだん 1 日以内に返信