Log4j 2
  1. Log4j 2
  2. LOG4J2-92

Filter Configuration Error when using KeyValuePair

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-alpha1, 2.0-alpha2, 2.0-beta2
    • Fix Version/s: 2.0-beta2
    • Component/s: Documentation, Filters
    • Labels:
      None
    • Environment:

      Win7

      Description

      When trying to configure DynamicThresholdFilter or StructuredDataFilter via XML according to the documentation on Filters, I get this error message from log4j2 :

      ERROR filter DynamicThresholdFilter has no parameter that matches element KeyValuePair

      <DynamicThresholdFilter key="loginId" defaultThreshold="ERROR" onMatch="ACCEPT" onMismatch="NEUTRAL">
      <KeyValuePair key="User1" value="DEBUG"/>
      </DynamicThresholdFilter>

      The problem seems to be present at other filters as well, where KeyValuePair is used.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1d 14h 26m 1 Ralph Goers 30/Sep/12 00:38
        Resolved Resolved Closed Closed
        13d 21h 28m 1 Szabolcs Beki 13/Oct/12 22:07
        Szabolcs Beki made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Szabolcs Beki added a comment -

        I tested it and it works fine.

        Show
        Szabolcs Beki added a comment - I tested it and it works fine.
        Hide
        Ralph Goers added a comment -

        Please verify the fix and close it.

        Show
        Ralph Goers added a comment - Please verify the fix and close it.
        Ralph Goers made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
        Fix Version/s 2.0-beta2 [ 12323283 ]
        Resolution Fixed [ 1 ]
        Hide
        Ralph Goers added a comment -

        Converted DynamicThresholdFilter to use KeyValuePairs. Modified Map-based filters to allow multiple values for a key to be specified. Corrected MapFilter's declaration of the KeyValuePair array to be a PluginElement instead of a PluginAttr

        Show
        Ralph Goers added a comment - Converted DynamicThresholdFilter to use KeyValuePairs. Modified Map-based filters to allow multiple values for a key to be specified. Corrected MapFilter's declaration of the KeyValuePair array to be a PluginElement instead of a PluginAttr
        Hide
        Szabolcs Beki added a comment -

        Thanks for quick answer.

        The other similar issue is with MapFilter.

        <MapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or">
        <KeyValuePair key="case-id" value="4"/>
        <KeyValuePair key="case-id" value="5"/>
        </MapFilter>

        results to :

        2012-09-28 20:41:17,715 ERROR filter MapFilter has no parameter that matches element KeyValuePair
        2012-09-28 20:41:17,716 ERROR filter MapFilter has no parameter that matches element KeyValuePair
        2012-09-28 20:41:17,717 ERROR keys and values must be specified for the MapFilter
        Null object returned for MapFilter

        Show
        Szabolcs Beki added a comment - Thanks for quick answer. The other similar issue is with MapFilter. <MapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or"> <KeyValuePair key="case-id" value="4"/> <KeyValuePair key="case-id" value="5"/> </MapFilter> results to : 2012-09-28 20:41:17,715 ERROR filter MapFilter has no parameter that matches element KeyValuePair 2012-09-28 20:41:17,716 ERROR filter MapFilter has no parameter that matches element KeyValuePair 2012-09-28 20:41:17,717 ERROR keys and values must be specified for the MapFilter Null object returned for MapFilter
        Hide
        Ralph Goers added a comment -

        Changing to a documentation issue. DynamicThresholdFilter uses a ValueLevelPair, not a KeyValuePair. It should be configured as

        <DynamicThresholdFilter key="loginId" defaultThreshold="ERROR" onMatch="ACCEPT" onMismatch="NEUTRAL">
        <ValueLevelPair key="User1" threshold="DEBUG"/>
        </DynamicThresholdFilter>

        Can you provide other instances where KeyValuePair is used where it isn't working?

        Show
        Ralph Goers added a comment - Changing to a documentation issue. DynamicThresholdFilter uses a ValueLevelPair, not a KeyValuePair. It should be configured as <DynamicThresholdFilter key="loginId" defaultThreshold="ERROR" onMatch="ACCEPT" onMismatch="NEUTRAL"> <ValueLevelPair key="User1" threshold="DEBUG"/> </DynamicThresholdFilter> Can you provide other instances where KeyValuePair is used where it isn't working?
        Ralph Goers made changes -
        Field Original Value New Value
        Component/s Documentation [ 12312247 ]
        Szabolcs Beki created issue -

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Szabolcs Beki
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development