<font size=2 face="Arial">Okay, I try to explain it again: I would like
to setting up the loglevels not only for a package, but for a method of
a class. I have no default way so it doesn't matter how to solve it. But
it is important that I can configure this rules easy in the logback.xml.
Of course multiple loggers would work, but I dont want to take hand on
the existing code.</font>
<br>
<br><font size=2 face="Arial">How could this work with markers?</font>
<br>
<br><font size=2 face="Arial">I had a look into the turbo filter, and yes
it works perfect. I have defined a class LoggingRule which contains the
classname and functionname for the Filtering. It looks like this:</font>
<br>
<br><font size=2 color=#008080 face="Courier New">
<</font><font size=2 color=#3f8080 face="Courier New">filter</font><font size=2 face="Courier New">
</font><font size=2 color=#800080 face="Courier New">class</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New"><i>"de.degussabank.logging.LoggingRuleFilter"</i></font><font size=2 color=#008080 face="Courier New">></font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#008080 face="Courier New"><</font><font size=2 color=#3f8080 face="Courier New">loggingRule</font><font size=2 face="Courier New">
</font><font size=2 color=#800080 face="Courier New">class</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New"><i>"de.degussabank.logging.LoggingRule"</i></font><font size=2 color=#008080 face="Courier New">></font>
<br><font size=2 color=#008080 face="Courier New">
<clazz></font><font size=2 face="Courier New">D</font><font size=2 color=#008080 face="Courier New"></clazz></font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#008080 face="Courier New"><</font><font size=2 color=#3f8080 face="Courier New">function</font><font size=2 color=#008080 face="Courier New">></font><font size=2 face="Courier New">method1</font><font size=2 color=#008080 face="Courier New"></</font><font size=2 color=#3f8080 face="Courier New">function</font><font size=2 color=#008080 face="Courier New">></font>
<br><font size=2 color=#008080 face="Courier New">
<</font><font size=2 color=#3f8080 face="Courier New">level</font><font size=2 color=#008080 face="Courier New">></font><font size=2 face="Courier New">INFO</font><font size=2 color=#008080 face="Courier New"></</font><font size=2 color=#3f8080 face="Courier New">Level</font><font size=2 color=#008080 face="Courier New">></font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#008080 face="Courier New"></</font><font size=2 color=#3f8080 face="Courier New">loggingRule</font><font size=2 color=#008080 face="Courier New">></font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#008080 face="Courier New"></</font><font size=2 color=#3f8080 face="Courier New">filter</font><font size=2 color=#008080 face="Courier New">></font>
<br>
<br><font size=2 face="Arial">But the problem I how can I configure the
TurboFilter easily? I expect a lot of different rules and don't want to
blast my configuration file. First I thought that I could do something
like include another configuration file but this only works for appenders
etc. not for enclosed elements like a filter...</font>
<br>
<br><font size=2 face="Arial">Is my explanation comprehendible?</font>
<br>
<br><font size=2 face="Arial">Marc</font>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Von:</font>
<td><font size=1 face="sans-serif">Ralph Goers <rgoers@apache.org></font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">An:</font>
<td><font size=1 face="sans-serif">logback users list <logback-user@qos.ch></font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Datum:</font>
<td><font size=1 face="sans-serif">20.09.2010 19:12</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Betreff:</font>
<td><font size=1 face="sans-serif">Re: [logback-user] Logging depending
on Class / Method</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Gesendet von:</font>
<td><font size=1 face="sans-serif">logback-user-bounces@qos.ch</font></table>
<br>
<hr noshade>
<br>
<br>
<br><font size=3>You really didn't provide enough information on what you
are trying to accomplish. What you are trying to do is filter what
events are logged. You could accomplish that by using Markers, multiple
loggers, or a configurable TurboFilter (the turbo filter can inspect the
method name of the caller). </font>
<br>
<br><font size=3>Ralph</font>
<br>
<br><font size=3>On Sep 20, 2010, at 7:21 AM, </font><a href="mailto:marc.baumgartner@degussa-bank.de"><font size=3 color=blue><u>marc.baumgartner@degussa-bank.de</u></font></a><font size=3>
wrote:</font>
<br>
<br><font size=2 face="sans-serif">Hi all,</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
is there a possibility to log depending on the class or method? For example
I have the following scenario:</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
package a.b.c</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
public Class D{</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Logger logger = LoggerFactory.getLogger(D.class);</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
public void method1(){</font><font size=3>
</font><font size=2 face="sans-serif"><br>
</font><a href=http://logger.info/><font size=2 color=blue face="sans-serif"><u>logger.info</u></font></a><font size=2 face="sans-serif">("method1");</font><font size=3>
</font><font size=2 face="sans-serif"><br>
}</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
public void method2(){</font><font size=3>
</font><font size=2 face="sans-serif"><br>
</font><a href=http://logger.info/><font size=2 color=blue face="sans-serif"><u>logger.info</u></font></a><font size=2 face="sans-serif">("method2");</font><font size=3>
</font><font size=2 face="sans-serif"><br>
}</font><font size=3> </font><font size=2 face="sans-serif"><br>
}</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
I look for something like this in logback configuration:</font><font size=3>
<br>
</font><font size=2 color=#008080 face="Courier New"><br>
<</font><font size=2 color=#3f8080 face="Courier New">logger</font><font size=2 face="Courier New">
</font><font size=2 color=#800080 face="Courier New">name</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New"><i>"a.b.c.D#method1"</i></font><font size=2 face="Courier New">
</font><font size=2 color=#800080 face="Courier New">level</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New"><i>"INFO"</i></font><font size=2 face="Courier New">
</font><font size=2 color=#008080 face="Courier New">/></font><font size=3>
<br>
</font><font size=2 color=#008080 face="Courier New"><br>
<</font><font size=2 color=#3f8080 face="Courier New">root</font><font size=2 face="Courier New">
</font><font size=2 color=#800080 face="Courier New">level</font><font size=2 face="Courier New">=</font><font size=2 color=#4200ff face="Courier New"><i>"WARN"</i></font><font size=2 color=#008080 face="Courier New">></font><font size=3>
</font><font size=2 color=#008080 face="Courier New"><br>
</root></font><font size=3> <br>
<br>
</font><font size=2 color=#008080 face="Courier New"><br>
After calling method1 and method2 I would expect only the log entry of
method 2.</font><font size=3> <br>
</font><font size=2 color=#008080 face="Courier New"><br>
Is this possible?</font><font size=3> <br>
</font><font size=2 color=#008080 face="Courier New"><br>
Thanks & regards,</font><font size=3> </font><font size=2 color=#008080 face="Courier New"><br>
Marc</font><font size=3> <br>
_______________________________________________<br>
Logback-user mailing list</font><font size=3 color=blue><u><br>
</u></font><a href="mailto:Logback-user@qos.ch"><font size=3 color=blue><u>Logback-user@qos.ch</u></font></a><font size=3><br>
</font><a href="http://qos.ch/mailman/listinfo/logback-user"><font size=3>http://qos.ch/mailman/listinfo/logback-user</font></a>
<br><tt><font size=2>_______________________________________________<br>
Logback-user mailing list<br>
Logback-user@qos.ch<br>
</font></tt><a href="http://qos.ch/mailman/listinfo/logback-user"><tt><font size=2>http://qos.ch/mailman/listinfo/logback-user</font></tt></a><tt><font size=2><br>
</font></tt>
<br>