Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspect/Pointcut to Determine Logger Type

Hi,

Your pointcut looks fine - are you just finding that it doesn't match
the getLogger call?  I typed your sample into AJDT and it worked and I
got the error marker on the Logger.getLogger() call line.  Perhaps it
is down to how you are compiling things:  Are you compiling all the
source together, including the aspect?  Are you binary weaving
(applying the aspect in source form to a pre-built jar file containing
the getLogger calls)?

Andy

On 3 March 2011 01:37, jimbob1987 <james.morgan.e@xxxxxxxxxxxxxx> wrote:
> Hi all, I'm quite new to Aspect J and am currently using it to enforce some
> Architecture Enforcements within all our application. I've set up several
> that work at present but I am struggling with the latest one. Problem: I are
> currently trying to move from Log4J to Lockback and slf4j, so for all new
> project I am trying to create an aspect to enforce a particular logging
> framework for use by the development team. This is out common Log4J logger
> creation code:
>
> import org.apache.log4j.Logger;
> private Logger log = Logger.getLogger(this.getClass());
>
> Problem aspect below:
>
> @DeclareError("call(* org.apache.log4j.Logger.*(..))")
> static final String usingLog4JLogger = "Dont instantiate a Log4J Logger, use
> a slf4j Logger Instead....!";
>
> Can anyone point me the right direction and tell me how I can create a
> pointcut to match all static Logger.getLogger(?) calls in my application.
> ________________________________
> View this message in context: Aspect/Pointcut to Determine Logger Type
> Sent from the AspectJ - users mailing list archive at Nabble.com.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top