I'm poor at writing in English. so sorry...
I want limit logging by method name base. and use class & method wildcard.
I want...
test.a.ClassA.java
public class ClassA {
public static void methodA() {
logger.debug("methodA called.");
test.b.ClassB.methodB();
}
}
test.b.ClassB.java
public class ClassB {
public static void methodB() {
logger.debug("methodB called.");
test.c.ClassC.methodC();
}
}
test.c.ClassC.java
public class ClassC {
public static void methodC() {
logger.debug("methodC called.");
}
}
log-config.xml case 1 - start log, ClassB all method.
<logger start="test.b.ClassB.*" level="debug">
<appender-ref ref="debugAppender"/>
</logger>
-- log output --
methodB called.
methodC called.
-- methodA not logged.
log-config.xml case 2 - start log, ClassC all method.
<logger start="test.c.ClassC.*" level="debug">
<appender-ref ref="debugAppender"/>
</logger>
-- log output --
methodC called.
-- methodA not logged.
-- methodB not logged.
log-config.xml case 3 - start log, ClassB specific method only.
<logger start="test.c.ClassB.methodB" level="debug"">
<appender-ref ref="debugAppender"/>
</logger>
-- log output --
methodB called.
methodC called.
-- methodA not logged.
log-config.xml case 4 - ClassB specific method only. not calling class, method logging
<logger only="test.c.ClassB.methodB" level="debug"">
<appender-ref ref="debugAppender"/>
</logger>
-- log output --
methodB called.
-- methodA not logged.
-- methodC not logged.
How to ?? custom logback ?? using LoggerFactory.getLogger ??
Help, please...