The level associated with the root appender is info. No debug events will make it past that.
Ralph > On Jun 25, 2015, at 3:39 PM, Benjamin Jaton <[email protected]> wrote: > > Hello, > > I am trying to create a filter at the appender level that would show all > the messages that contain "Show". > This is my test: > > LogManager.getLogger(Test.class).debug("Hide me!"); > LogManager.getLogger(Test.class).info("test"); > LogManager.getLogger(Test.class).debug("Show me (debug)"); > LogManager.getLogger(Test.class).fatal("Hide me! (fatal)"); > LogManager.getLogger(Test.class).info("Show me (info)"); > LogManager.getLogger(Test.class).info("Hide me!"); > > And this is the configuration: > > <Configuration status="debug" name="MyApp" packages=""> > <Appenders> > <SMTP name="Mail" subject="Error Log" to="..." from="..." > smtpProtocol="..." smtpHost="..." smtpPort="..." smtpUsername="..." > smtpPassword="..." bufferSize="1"> > <RegexFilter regex=".*Show.*" onMatch="ACCEPT" onMismatch="DENY"/> > <PatternLayout> > <pattern>%5p %m%n</pattern> > </PatternLayout> > </SMTP> > </Appenders> > <Loggers> > <Root level="info"> > <AppenderRef ref="Mail"/> > </Root> > </Loggers> > </Configuration> > > This produces 1 email with: > --------------------------------------- > FATAL Hide me! (fatal) > INFO Show me (info) > --------------------------------------- > > I would expect 2 emails with: > --------------------------------------- > INFO test > DEBUG Show me (debug) > --------------------------------------- > FATAL Hide me! (fatal) > INFO Show me (info) > --------------------------------------- > > I also tried this composite filter instead: > <Filters> > <ThresholdFilter level="TRACE" onMatch="NEUTRAL" > onMismatch="DENY" /> > <RegexFilter regex=".*Show.*" onMatch="ACCEPT" onMismatch="DENY"/> > </Filters> > > But same result, the DEBUG event is not triggering the appender somehow. > > Anyone has an idea how to do this? > > > Bonus question: Since bufferSize can't be set to 0, is it not possible to > only include the log message itself in the email? > > Many thanks! > Ben --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
