<font size=2 face="Arial">My Logback version is 0.9.24</font>
<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">"无所谓" <yxxcrtd@gmail.com></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">21.09.2010 10:13</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] Antwort: Re: 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>
<br><font size=3 face="sans-serif">what's your logback version?</font>
<br>
<br><font size=3 face="sans-serif"> </font>
<br><font size=3 face="sans-serif"> </font>
<br><font size=1 face="Arial">------------------ Original ------------------</font>
<br><font size=1 face="sans-serif"><b>From: </b> "marc.baumgartner"<marc.baumgartner@degussa-bank.de>;</font>
<br><font size=1 face="sans-serif"><b>Date: </b> Tue, Sep 21, 2010
02:38 PM</font>
<br><font size=1 face="sans-serif"><b>To: </b> "logback users
list"<logback-user@qos.ch>; </font>
<br><font size=1 face="sans-serif"><b>Subject: </b> [logback-user]
Antwort: Re: Logging depending on Class / Method</font>
<br><font size=3 face="sans-serif"> </font>
<br><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><font size=3 face="sans-serif"> <br>
</font><font size=2 face="Arial"><br>
How could this work with markers?</font><font size=3 face="sans-serif">
<br>
</font><font size=2 face="Arial"><br>
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><font size=3 face="sans-serif"> <br>
</font><font size=2 color=#008080 face="Courier New"><br>
<</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><font size=3 face="sans-serif">
</font><font size=2 face="Courier New"><br>
</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><font size=3 face="sans-serif">
</font><font size=2 color=#008080 face="Courier New"><br>
<clazz></font><font size=2 face="Courier New">D</font><font size=2 color=#008080 face="Courier New"></clazz></font><font size=3 face="sans-serif">
</font><font size=2 face="Courier New"><br>
</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><font size=3 face="sans-serif">
</font><font size=2 color=#008080 face="Courier New"><br>
<</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><font size=3 face="sans-serif">
</font><font size=2 face="Courier New"><br>
</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><font size=3 face="sans-serif">
</font><font size=2 face="Courier New"><br>
</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><font size=3 face="sans-serif">
<br>
</font><font size=2 face="Arial"><br>
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><font size=3 face="sans-serif"> <br>
</font><font size=2 face="Arial"><br>
Is my explanation comprehendible?</font><font size=3 face="sans-serif">
<br>
</font><font size=2 face="Arial"><br>
Marc</font><font size=3 face="sans-serif"> <br>
<br>
<br>
<br>
</font>
<table width=100%>
<tr valign=top>
<td width=21%><font size=1 color=#5f5f5f face="sans-serif">Von:</font><font size=3 face="sans-serif">
</font>
<td width=78%><font size=1 face="sans-serif">Ralph Goers <rgoers@apache.org></font><font size=3 face="sans-serif">
</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">An:</font><font size=3 face="sans-serif">
</font>
<td><font size=1 face="sans-serif">logback users list <logback-user@qos.ch></font><font size=3 face="sans-serif">
</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Datum:</font><font size=3 face="sans-serif">
</font>
<td><font size=1 face="sans-serif">20.09.2010 19:12</font><font size=3 face="sans-serif">
</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Betreff:</font><font size=3 face="sans-serif">
</font>
<td><font size=1 face="sans-serif">Re: [logback-user] Logging depending
on Class / Method</font><font size=3 face="sans-serif"> </font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Gesendet von:</font><font size=3 face="sans-serif">
</font>
<td><font size=1 face="sans-serif">logback-user-bounces@qos.ch</font></table>
<br><font size=3 face="sans-serif"><br>
</font>
<hr noshade><font size=3 face="sans-serif"><br>
<br>
<br>
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).
<br>
<br>
Ralph <br>
<br>
On Sep 20, 2010, at 7:21 AM, </font><a href="mailto:marc.baumgartner@degussa-bank.de"><font size=3 color=blue face="sans-serif"><u>marc.baumgartner@degussa-bank.de</u></font></a><font size=3 face="sans-serif">
wrote: <br>
</font><font size=2 face="sans-serif"><br>
Hi all,</font><font size=3 face="sans-serif"> </font><font size=2 face="sans-serif"><br>
<br>
is there a possibility to log depending on the class or method? For example
I have the following scenario:</font><font size=3 face="sans-serif"> </font><font size=2 face="sans-serif"><br>
<br>
package a.b.c</font><font size=3 face="sans-serif"> </font><font size=2 face="sans-serif"><br>
<br>
public Class D{</font><font size=3 face="sans-serif"> </font><font size=2 face="sans-serif"><br>
<br>
Logger logger = LoggerFactory.getLogger(D.class);</font><font size=3 face="sans-serif">
</font><font size=2 face="sans-serif"><br>
<br>
public void method1(){</font><font size=3 face="sans-serif">
</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 face="sans-serif">
</font><font size=2 face="sans-serif"><br>
}</font><font size=3 face="sans-serif"> </font><font size=2 face="sans-serif"><br>
<br>
public void method2(){</font><font size=3 face="sans-serif">
</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 face="sans-serif">
</font><font size=2 face="sans-serif"><br>
}</font><font size=3 face="sans-serif"> </font><font size=2 face="sans-serif"><br>
}</font><font size=3 face="sans-serif"> </font><font size=2 face="sans-serif"><br>
<br>
I look for something like this in logback configuration:</font><font size=3 face="sans-serif">
</font><font size=2 color=#008080 face="Courier New"><br>
<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 face="sans-serif">
</font><font size=2 color=#008080 face="Courier New"><br>
<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 face="sans-serif">
</font><font size=2 color=#008080 face="Courier New"><br>
</root></font><font size=3 face="sans-serif"> <br>
</font><font size=2 color=#008080 face="Courier New"><br>
<br>
After calling method1 and method2 I would expect only the log entry of
method 2.</font><font size=3 face="sans-serif"> </font><font size=2 color=#008080 face="Courier New"><br>
<br>
Is this possible?</font><font size=3 face="sans-serif"> </font><font size=2 color=#008080 face="Courier New"><br>
<br>
Thanks & regards,</font><font size=3 face="sans-serif"> </font><font size=2 color=#008080 face="Courier New"><br>
Marc</font><font size=3 face="sans-serif"> <br>
_______________________________________________<br>
Logback-user mailing list</font><font size=3 color=blue face="sans-serif"><u><br>
</u></font><a href="mailto:Logback-user@qos.ch"><font size=3 color=blue face="sans-serif"><u>Logback-user@qos.ch</u></font></a><font size=3 color=blue face="sans-serif"><u><br>
</u></font><a href="http://qos.ch/mailman/listinfo/logback-user"><font size=3 color=blue face="sans-serif"><u>http://qos.ch/mailman/listinfo/logback-user</u></font></a><font size=3 face="sans-serif">
</font><tt><font size=2><br>
_______________________________________________<br>
Logback-user mailing list<br>
Logback-user@qos.ch</font></tt><font size=3 color=blue face="sans-serif"><u><br>
</u></font><a href="http://qos.ch/mailman/listinfo/logback-user"><tt><font size=2 color=blue><u>http://qos.ch/mailman/listinfo/logback-user</u></font></tt></a><font size=3 face="sans-serif"><br>
</font><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>