My Logback version is 0.9.24



Von:
"无所谓" <[email protected]>
An:
"logback users list" <[email protected]>
Datum:
21.09.2010 10:13
Betreff:
Re: [logback-user] Antwort: Re: Logging depending on Class / Method
Gesendet von:
[email protected]




what's your logback version?

 
 
------------------ Original ------------------
From:  "marc.baumgartner"<[email protected]>;
Date:  Tue, Sep 21, 2010 02:38 PM
To:  "logback users list"<[email protected]>; 
Subject:  [logback-user] Antwort: Re: Logging depending on Class / Method
 
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. 

How could this work with markers? 

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: 

                <filter class="de.degussabank.logging.LoggingRuleFilter"> 
                        <loggingRule class=
"de.degussabank.logging.LoggingRule"> 
                                <clazz>D</clazz> 
                                <function>method1</function> 
                                <level>INFO</Level> 
                        </loggingRule> 
                </filter> 

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... 

Is my explanation comprehendible? 

Marc 




Von: 
Ralph Goers <[email protected]> 
An: 
logback users list <[email protected]> 
Datum: 
20.09.2010 19:12 
Betreff: 
Re: [logback-user] Logging depending on Class / Method 
Gesendet von: 
[email protected]




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). 

Ralph 

On Sep 20, 2010, at 7:21 AM, [email protected] wrote: 

Hi all, 

is there a possibility to log depending on the class or method? For 
example I have the following scenario: 

package a.b.c 

public Class D{ 

       Logger logger = LoggerFactory.getLogger(D.class); 

       public void method1(){ 
               logger.info("method1"); 
       } 

       public void method2(){ 
               logger.info("method2"); 
       } 
} 

I look for something like this in logback configuration: 

<logger name="a.b.c.D#method1" level="INFO" /> 

<root level="WARN"> 
</root> 


After calling method1 and method2 I would expect only the log entry of 
method 2. 

Is this possible? 

Thanks & regards, 
Marc 
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user 
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user


_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user

Reply via email to