<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Why do you want to use a TurboFilter instead of a regular filter?<div><br></div><div>Ralph</div><div><br><div><div>On Jul 13, 2010, at 6:15 AM, Espen Rydningen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Sorry for the double post, gmail pulled a trick on me :) Just ignore the other post.<br><br>Hi<br><br>I want to revisit this subject and theme. <a href="http://marc.info/?l=logback-user&amp;m=121130259107132&amp;w=2">I saw that this thread ended 20th May 2008</a>, but I did not find any conclusions on your discussion. The reason I find this subject interesting, is that I have use case which I can't seem to solve in any other way then setting a turbofilter on an appender.<br>
<br>This is situation:<br>One enterprise web application, which today uses a proprietary, home built, logging framework, logs statement to both file and to a database via an EJB. I have started the work to replace this logging framework with LogBack/SL4J.<br>
<br>Our new design would include file appender, and a jms appender which posts to a jms queue.<br><br>Example of log statements in the current solution:<br>&lt;codeSnippet&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //The logger is the file logger<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.debug("Bar property was not defined in abc.properties");<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //FooLog is responsible for sending log message to the EJB<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LogContext lctx = new LogContext("webapplication", getClass().getName(),
 "theFooBarMethod()", LayerType.PRESENTATION);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FooLog.log(logcontext, 6001, new String[] { "Bar property was not defined in abc.properties" }, null);<br>&lt;/codeSnippet&gt;<br><br>
This type of logging I want to change to this kind of logging:<br>&lt;codeSnippet&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.debug("Bar property was 
not defined in abc.properties");<br>&lt;/codeSnippet&gt;<br>
<br>This is my use case:<br>We need to separate which log statements that goes to file and which goes to JMS (and eventually to database) <br><br>This is how I want to solve it:<br><br>This would only go to file<br>&lt;codeSnippet&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.debug("Bar property was not defined in abc.properties");<br>&lt;/codeSnippet&gt;<br><br>But this would go to both file and jms<br>&lt;codeSnippet&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Marker JMS_MARKER = MarkerFactory.getMarker("JMS");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.debug(JMS_MARKER, "Bar property was not defined in abc.properties");<br>&lt;/codeSnippet&gt;<br><br>This could be obtained by doing something like this:<br><br>&lt;appender name="Queue" class="com.a.b.c.log.CustomJMSQueueAppender"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;InitialContextFactoryName&gt;org.apache.activemq.jndi.ActiveMQInitialContextFactory&lt;/InitialContextFactoryName&gt;<br>&nbsp;&nbsp;&nbsp; &lt;ProviderURL&gt;tcp://localhost:61616&lt;/ProviderURL&gt;<br>&nbsp;&nbsp;&nbsp; &lt;QueueConnectionFactoryBindingName&gt;ConnectionFactory&lt;/QueueConnectionFactoryBindingName&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;QueueBindingName&gt;MyQueue&lt;/QueueBindingName&gt;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &lt;turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Marker&gt;JMS&lt;/Marker&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;OnMismatch&gt;DENY&lt;/OnMismatch&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/turboFilter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; &lt;/appender&gt;<br><br>To end this; Is my use case covered in LogBack framework somehow, without waiting for this kind of features?<br>
_______________________________________________<br>Logback-user mailing list<br><a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>http://qos.ch/mailman/listinfo/logback-user<br></blockquote></div><br></div></body></html>