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

        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.
        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?

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development