-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix RegexFilter
pattern flags
#3086
Comments
RegexFilter
pattern flags
Hi @JWT007, Thank you for helping us checking our documentation against the automatically-generated plugin reference. We created the plugin reference exactly for this purpose and we are happy you find it useful. This is a longstanding LOG4J2-696 bug, old as Log4j 2 itself. The attempted solution has no chance to work, since the Since you can embed pattern flags in the regex (e.g. |
@ppkarwasz - added another new PR. Please review if OK how I deprecated old pluginFactory and created new one. |
+ made AbstractFiltter.AbstractFilterBuilder onMatch/onMismatch fields protected + added AbstractFilter(AbstractFilterBuilder) constructor + added RegexFilter.Builder implementation + added RegexFilter(Builder) constructor + moved RegexFilter Pattern compile into constructor + added fields to persist configuration propertties + getters (regexExpression, patternFlags) + changed private constructor to accept builder as argument + renamed private method 'targetMessageTest' to more approprriate 'getMessageTextByType' + added Javadoc + grouped deprecations
+ made AbstractFiltter.AbstractFilterBuilder onMatch/onMismatch fields protected + added AbstractFilter(AbstractFilterBuilder) constructor + added RegexFilter.Builder implementation + added RegexFilter(Builder) constructor + moved RegexFilter Pattern compile into constructor + added fields to persist configuration propertties + getters (regexExpression, patternFlags) + changed private constructor to accept builder as argument + renamed private method 'targetMessageTest' to more approprriate 'getMessageTextByType' + added Javadoc + grouped deprecations
+ added validation checks to RegexFilter + added JVerify nullability annotations to RegexFilter + updated javadoc + replaced deprecated usages of CompositeFilter#getFilters with CompositeFilter#getFiltersArray in AbstractFilterableTest
+ made AbstractFiltter.AbstractFilterBuilder onMatch/onMismatch fields protected + added AbstractFilter(AbstractFilterBuilder) constructor + added RegexFilter.Builder implementation + added RegexFilter(Builder) constructor + moved RegexFilter Pattern compile into constructor + added fields to persist configuration propertties + getters (regexExpression, patternFlags) + changed private constructor to accept builder as argument + renamed private method 'targetMessageTest' to more approprriate 'getMessageTextByType' + added Javadoc + grouped deprecations
+ added validation checks to RegexFilter + added JVerify nullability annotations to RegexFilter + updated javadoc + replaced deprecated usages of CompositeFilter#getFilters with CompositeFilter#getFiltersArray in AbstractFilterableTest
… createFilter. (apache#3086) 8d05a7
+ made AbstractFiltter.AbstractFilterBuilder onMatch/onMismatch fields protected + added AbstractFilter(AbstractFilterBuilder) constructor + added RegexFilter.Builder implementation + added RegexFilter(Builder) constructor + moved RegexFilter Pattern compile into constructor + added fields to persist configuration propertties + getters (regexExpression, patternFlags) + changed private constructor to accept builder as argument + renamed private method 'targetMessageTest' to more approprriate 'getMessageTextByType' + added Javadoc + grouped deprecations
+ added validation checks to RegexFilter + added JVerify nullability annotations to RegexFilter + updated javadoc + replaced deprecated usages of CompositeFilter#getFilters with CompositeFilter#getFiltersArray in AbstractFilterableTest
…ot yet been merged to main (apache#3086)
In the Log4j 2.x documentation for the RegexFilter:
https://logging.apache.org/log4j/2.x/manual/filters.html#RegexFilter
The only two configuration attributes are "regex" and "useRawMsg" (and the common filter attributes onMatch/onMismatch).
In the RegExFilter @pluginfactory there is a nested element for a set of Strings which is not mentioned in the documentation:
If I understand correctly one can provide field names from the Pattern class here: (CASE_INSENSITIVE, COMMENTS, etc.).
The example in the Plugin Reference for the RegexFilter shows an example of nested strings but is not very clear with "a-String-implementation":
Is it?:
A usage example would be helpful.
Maybe this API is not really "public"? In the log4j-core-test RegexFilter test it seems the RegexFilter is never tested with anything but a null value for the patternFlags.
The text was updated successfully, but these errors were encountered: