[logback-user] Evaluators and Markers - no applicable action

buzzterrier terry.jeske at gmail.com
Thu May 20 17:24:18 CEST 2010


Thx. Ceki, that works, but I have a question about how the filtering works:

  Java Main:

	public static void main(String[] args) {
		Marker notifyAdminMarker = MarkerFactory.getMarker("NOTIFY_ADMIN");
		Logger logger = LoggerFactory.getLogger(LogBackTest.class);
		
		logger.debug("This is a regular debug message");
		
		logger.debug(notifyAdminMarker,	"Serious issue");
	}
}

Logback.xml snippet:

   <appender name="EMAIL"
   	 class="ch.qos.logback.core.ConsoleAppender">
     <filter class="ch.qos.logback.core.filter.EvaluatorFilter">      
      <evaluator> 
        <expression>marker.contains("NOTIFY_ADMIN")</expression>
      </evaluator>
 		<OnMatch>ACCEPT</OnMatch>
 		<OnMismatch>DENY</OnMismatch>
    </filter>

    <encoder>
      <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  
  </appender>

 

Running the above java and appender I get:
08:10:39.183 DEBUG aero.blue.logtest.LogBackTest - This is a regular debug
message
08:10:39.190 DEBUG aero.blue.logtest.LogBackTest - Serious issue

I expected to just get the Serious Issue line.

Further, if I change the eval logic to Not match i.e.:

         <expression>!marker.contains("NOTIFY_ADMIN")</expression>
I get:
08:16:47.035 DEBUG aero.blue.logtest.LogBackTest - This is a regular debug
message
 
Which is what I would expect, so is the inverse not working?

-----
Buzzterrier

http://buzzterrier.blogspot.com/ View my blog: Ordinary Average Developer... 
-- 
View this message in context: http://old.nabble.com/Evaluators-and-Markers----no-applicable-action-tp28609431p28622819.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list