如何将 log4j StringMatchFilter 转换为 log4j2?
How to convert log4j StringMatchFilter to log4j2?
我目前面临将 StringMatchFilter 从 Log4j 转换为 Log4j2 的问题。我在版本 2 中找不到任何其他过滤器,所以我有点卡在这里。
log4j.appender.CONSOLE.filter.1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.CONSOLE.filter.1.AcceptOnMatch=false
log4j.appender.CONSOLE.filter.1.StringToMatch=Could not remove JaloSession
JaloSession
尝试使用 MarkerFilter。 MarkerFilter 将做同样的工作。示例:
<Filters>
<MarkerFilter marker="STR1" onMatch="DENY" onMismatch="NEUTRAL"/>
<MarkerFilter marker="Str2" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
我想你想要 RegexFilter
这个。
类似于:
<RegexFilter regex=".*Could not remove JaloSession.*" onMatch="DENY" onMismatch="ACCEPT"/>
我目前面临将 StringMatchFilter 从 Log4j 转换为 Log4j2 的问题。我在版本 2 中找不到任何其他过滤器,所以我有点卡在这里。
log4j.appender.CONSOLE.filter.1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.CONSOLE.filter.1.AcceptOnMatch=false
log4j.appender.CONSOLE.filter.1.StringToMatch=Could not remove JaloSession
JaloSession
尝试使用 MarkerFilter。 MarkerFilter 将做同样的工作。示例:
<Filters>
<MarkerFilter marker="STR1" onMatch="DENY" onMismatch="NEUTRAL"/>
<MarkerFilter marker="Str2" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
我想你想要 RegexFilter
这个。
类似于:
<RegexFilter regex=".*Could not remove JaloSession.*" onMatch="DENY" onMismatch="ACCEPT"/>