Attached the debug-level output.
Also - the annotations are not relevant since I'm currently not using my
filter but the ThresholdFilter which I assume is written correctly :)
Thanks,
Guy

On Tue, Dec 6, 2016 at 10:18 PM, Matt Sicker <[email protected]> wrote:

> Can you set status="debug" in your <configuration/> element? Also, did you
> remember to add all the necessary annotations on your plugin along with
> enabling annotation processing if needed?
>
> On 6 December 2016 at 13:59, Guy Marom <[email protected]> wrote:
>
> > Hello everyone,
> >
> > I have a problem with activating a context-wide filter. I created my own
> > filter, made it inherit from *AbstractFilter* and then overridden the
> > method
> >
> > public Result filter(LogEvent event)
> >
> > This method was never called so I decided to try with an existing filter,
> > here's my config file:
> >
> > <configuration monitorInterval="5">
> >   <!--<MetricWritingFilter />-->
> >   <ThresholdFilter level="TRACE" onMatch="DENY" onMismatch="DENY"/>
> >
> >   <appenders>
> >     <console name="stdout" target="SYSTEM_OUT">
> >       <patternLayout pattern="%d{ABSOLUTE} %5p %c{1}:%L - %m%n"/>
> >     </console>
> >   </appenders>
> >
> >   <loggers>
> >     <logger name="com.outbrain.test" level="info" />
> >     <root level="error">
> >       <!--<appenderRef ref="wfePartitionedJobAppender"/>-->
> >       <appenderRef ref="stdout"/>
> >     </root>
> >   </loggers>
> > </configuration>
> >
> >
> > The filter works but when I put a breakpoint inside the ThresholdFilter
> > class I see it doesn't stop in the method I mentioned earlier:
> > [image: Inline image 1]
> >
> > Am I missing something here?
> >
> > Thanks,
> > Guy Marom
> >
>
>
>
> --
> Matt Sicker <[email protected]>
>
2016-12-07 06:18:34,499 main DEBUG Initializing configuration 
XmlConfiguration[location=/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml]
2016-12-07 06:18:34,506 main DEBUG Installed script engines
2016-12-07 06:18:34,870 main DEBUG Oracle Nashorn Version: 1.8.0_91, Language: 
ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, 
Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
2016-12-07 06:18:34,870 main DEBUG PluginManager 'Core' found 108 plugins
2016-12-07 06:18:34,871 main DEBUG PluginManager 'Level' found 0 plugins
2016-12-07 06:18:34,874 main DEBUG 1 starting Log4j2 ConfigurationScheduler 
threads
2016-12-07 06:18:34,875 main DEBUG PluginManager 'Lookup' found 13 plugins
2016-12-07 06:18:34,877 main DEBUG Building Plugin[name=filter, 
class=org.apache.logging.log4j.core.filter.ThresholdFilter].
2016-12-07 06:18:34,889 main DEBUG PluginManager 'TypeConverter' found 23 
plugins
2016-12-07 06:18:34,898 main DEBUG createFilter(level="TRACE", onMatch="DENY", 
onMismatch="DENY")
2016-12-07 06:18:34,899 main DEBUG Building Plugin[name=layout, 
class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-12-07 06:18:34,919 main DEBUG PatternLayout$Builder(pattern="%d{ABSOLUTE} 
%5p %c{1}:%L - %m%n", PatternSelector=null, 
Configuration(/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml),
 Replace=null, charset="null", alwaysWriteExceptions="null", 
noConsoleNoAnsi="null", header="null", footer="null")
2016-12-07 06:18:34,919 main DEBUG PluginManager 'Converter' found 41 plugins
2016-12-07 06:18:34,921 main DEBUG Building Plugin[name=appender, 
class=org.apache.logging.log4j.core.appender.ConsoleAppender].
2016-12-07 06:18:34,928 main DEBUG ConsoleAppender$Builder(target="SYSTEM_OUT", 
follow="null", direct="null", bufferedIo="null", bufferSize="null", 
immediateFlush="null", ignoreExceptions="null", patternLayout(%d{ABSOLUTE} %5p 
%c{1}:%L - %m%n), name="stdout", Filter=null)
2016-12-07 06:18:34,929 main DEBUG Starting OutputStreamManager 
SYSTEM_OUT.false.false
2016-12-07 06:18:34,929 main DEBUG Building Plugin[name=appenders, 
class=org.apache.logging.log4j.core.config.AppendersPlugin].
2016-12-07 06:18:34,930 main DEBUG createAppenders(={stdout})
2016-12-07 06:18:34,930 main DEBUG Building Plugin[name=logger, 
class=org.apache.logging.log4j.core.config.LoggerConfig].
2016-12-07 06:18:34,933 main DEBUG createLogger(additivity="true", 
level="INFO", name="com.outbrain.test", includeLocation="null", ={}, ={}, 
Configuration(/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml),
 Filter=null)
2016-12-07 06:18:34,935 main DEBUG Building Plugin[name=AppenderRef, 
class=org.apache.logging.log4j.core.config.AppenderRef].
2016-12-07 06:18:34,936 main DEBUG createAppenderRef(ref="stdout", 
level="null", Filter=null)
2016-12-07 06:18:34,937 main DEBUG Building Plugin[name=root, 
class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2016-12-07 06:18:34,938 main DEBUG createLogger(additivity="null", 
level="ERROR", includeLocation="null", ={stdout}, ={}, 
Configuration(/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml),
 Filter=null)
2016-12-07 06:18:34,939 main DEBUG Building Plugin[name=loggers, 
class=org.apache.logging.log4j.core.config.LoggersPlugin].
2016-12-07 06:18:34,940 main DEBUG createLoggers(={com.outbrain.test, root})
2016-12-07 06:18:34,941 main DEBUG Configuration 
XmlConfiguration[location=/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml]
 initialized
2016-12-07 06:18:34,941 main DEBUG Starting configuration 
XmlConfiguration[location=/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml]
2016-12-07 06:18:34,943 main DEBUG Started configuration 
XmlConfiguration[location=/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml]
 OK.
2016-12-07 06:18:34,943 main DEBUG Shutting down OutputStreamManager 
SYSTEM_OUT.false.false-1
2016-12-07 06:18:34,944 main DEBUG Shut down OutputStreamManager 
SYSTEM_OUT.false.false-1, all resources released: true
2016-12-07 06:18:34,944 main DEBUG Stopped 
org.apache.logging.log4j.core.config.DefaultConfiguration@4534b60d OK
2016-12-07 06:18:34,996 main DEBUG Registering MBean 
org.apache.logging.log4j2:type=7ea987ac
2016-12-07 06:18:34,998 main DEBUG Registering MBean 
org.apache.logging.log4j2:type=7ea987ac,component=StatusLogger
2016-12-07 06:18:34,999 main DEBUG Registering MBean 
org.apache.logging.log4j2:type=7ea987ac,component=ContextSelector
2016-12-07 06:18:35,001 main DEBUG Registering MBean 
org.apache.logging.log4j2:type=7ea987ac,component=Loggers,name=
2016-12-07 06:18:35,002 main DEBUG Registering MBean 
org.apache.logging.log4j2:type=7ea987ac,component=Loggers,name=com.outbrain.test
2016-12-07 06:18:35,003 main DEBUG Registering MBean 
org.apache.logging.log4j2:type=7ea987ac,component=Appenders,name=stdout
2016-12-07 06:18:35,008 main DEBUG Reconfiguration complete for 
context[name=7ea987ac] at URI 
/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml 
(org.apache.logging.log4j.core.LoggerContext@12468a38) with optional 
ClassLoader: null
2016-12-07 06:18:35,008 main DEBUG Shutdown hook enabled. Registering a new one.
2016-12-07 06:18:35,009 main DEBUG LoggerContext[name=7ea987ac, 
org.apache.logging.log4j.core.LoggerContext@12468a38] started OK.
2016-12-07 06:18:35,012 pool-1-thread-1 DEBUG Stopping 
LoggerContext[name=7ea987ac, 
org.apache.logging.log4j.core.LoggerContext@12468a38]
2016-12-07 06:18:35,013 pool-1-thread-1 DEBUG Stopping 
LoggerContext[name=7ea987ac, 
org.apache.logging.log4j.core.LoggerContext@12468a38]...
2016-12-07 06:18:35,014 pool-1-thread-1 DEBUG Shutting down OutputStreamManager 
SYSTEM_OUT.false.false
2016-12-07 06:18:35,014 pool-1-thread-1 DEBUG Shut down OutputStreamManager 
SYSTEM_OUT.false.false, all resources released: true
2016-12-07 06:18:35,015 pool-1-thread-1 DEBUG Log4j2 ConfigurationScheduler 
shutting down threads in 
java.util.concurrent.ScheduledThreadPoolExecutor@7287090c[Running, pool size = 
1, active threads = 0, queued tasks = 1, completed tasks = 0]
2016-12-07 06:18:35,015 pool-1-thread-1 DEBUG Stopped 
XmlConfiguration[location=/home/gmarom/dev/tests/maven-test/src/main/resources/log4j2-with-filter.xml]
 OK
2016-12-07 06:18:35,016 pool-1-thread-1 DEBUG Stopped 
LoggerContext[name=7ea987ac, 
org.apache.logging.log4j.core.LoggerContext@12468a38]...
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to