Hi,<br><br>i'm implementing a loggin via AspectJ in a Maven project.<br><br>My aspect class is something like this...<br><br><br>public aspect TraceMethodCalls {
<br> <br> static Marker ASPECTJ_TRACE_ENTER = MarkerFactory.getMarker("ASPECTJ_TRACE_ENTER");
<br> <br> final Logger logger = LoggerFactory.getLogger(TraceMethodCalls.class);
<br> <br> TraceMethodCalls() {
<br> }
<br> <br> pointcut traceMethods()
<br> //give me all method calls of every class with every visibility
<br> : (execution(* *.*(..))
<br> //give me also constructor calls
<br> || execution(*.new(..)))
<br> && !execution(* toString(..)) && !execution(* hashCode(..))
<br> //stop recursion don't get method calls in this aspect class itself
<br> && !within(TraceMethodCalls);
<br> <br> //advice before: do something before method is really executed
<br> before() : traceMethods() {
<br> if (logger.isDebugEnabled()) {
<br> //get info about captured method and log it
<br> Signature sig = thisJoinPointStaticPart.getSignature();
<br>
<br> logger.trace(ASPECTJ_TRACE_ENTER, "---> [" + sig.toShortString() + "]");
<br>
<br> }
<br> }
<br>
<br> //advice before: do something before method is really executed
<br> after() returning (Object o): traceMethods() {
<br> if (logger.isDebugEnabled()) {
<br> //get info about captured method and log it
<br> Signature sig = thisJoinPointStaticPart.getSignature();
<br>
<br> logger.trace(ASPECTJ_TRACE_ENTER, "<--- [" + sig.toShortString() + "]");
<br>
<br> }
<br> }<br><br>and logback appender<br><br><br> <appender name="ASPECTJ_TRACE_ENTER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<br> <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<br> <evaluator class="ch.qos.logback.classic.boolex.JaninoEventEvaluator">
<br> <expression>
<br> (marker != null) &amp;&amp; (marker.contains("ASPECTJ_TRACE_ENTER"))
<br> </expression>
<br> </evaluator>
<br> <onMatch>ACCEPT</onMatch>
<br> <onMismatch>DENY</onMismatch> <br> </filter>
<br> <br> <prudent>${prudent}</prudent>
<br>
<br> <!-- full stacktrace para las excepciones -->
<br> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<br> <Pattern>%date %-5level - cn=%contextName - [%thread] - %message%n</Pattern>
<br> </encoder>
<br> <br> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<br> <FileNamePattern>${USER_HOME}/${backupDir}aspectj.enter_exit.%d${patronRolling}</FileNamePattern>
<br> <MaxHistory>${maxHistory}</MaxHistory>
<br> </rollingPolicy>
<br> </appender><br><br>I see that that support to NDC is disabled in logback, how could i implement a TAB of this messages without NCD?<br><br>--->Method1<br>------>Method2<br>--------->Method3<br><---------Method3<br clear="all">
<------Method2<br><---Method1<br><br><br>Thanks.<br><br>-- <br>Jose Juan Montiel Martinez<br>Eurobits Technologies<br>Calle Musgo 3, 1ยช Planta<br>28023 Madrid<br>T +34-917080300<br>F +34-913077480<br><a href="mailto:josejuan.montiel@eurobits.es">josejuan.montiel@eurobits.es</a><br>
<a href="http://www.eurobits.com">http://www.eurobits.com</a><br>