Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1154

Javadoc for AbstractFilter wrong?

    XMLWordPrintableJSON

    Details

    • Type: Documentation
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4
    • Fix Version/s: None
    • Component/s: Filters
    • Labels:
      None

      Description

      The class org.apache.logging.log4j.core.Filter has as javadoc for the filter methods just the description: Filter an event.

      The org.apache.logging.log4j.core.filter.AbstractFilter has as description for three of the filter methods:

      • Appender Filter method. The default returns NEUTRAL.*
        could you clarify when each of these will be called?

      And the last one filter(LogEvent) has as decription Context Filter method. The default returns NEUTRAL.
      But this method isn't called, when I configure the filter as context filter.

      My config looks like:

      <configuration name="test" packages="my.package">
          <MyFilter/>
          <Appenders>
              <Console name="Console" target="SYSTEM_OUT">
                  <PatternLayout
                          pattern="m%n"
                          charset="UTF-8"/>
              </Console>
          </Appenders>
          <Loggers>
              <root level="DEBUG">
                  <AppenderRef ref="Console"/>
              </root>
          </Loggers>
      </configuration>
      

      And btw., do I understand it correctly that each logger calls all Context Filter as well? So that the only benefit of a context filter is that it's shared acrossed Logger, but not actually allowing reducing the invocation count of the filter as if it was defined for each Logger?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pknobel Philipp Knobel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: