Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Re: Log4J and Logger.getLogger practices

Hi,

That's also my approach but I'm using commons-logging. You can take my
aspect that logs entries, returns and exception throwing from
http://cvs.sourceforge.net/viewcvs.py/oness/common/all/src/aspectj/net/sf/on
ess/common/all/logging/LoggingAspect.aj?rev=1.4&view=auto 

Please tell me if you like it.

Regards

Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net


> -----Original Message-----
> From: aspectj-users-admin@xxxxxxxxxxx 
> [mailto:aspectj-users-admin@xxxxxxxxxxx] On Behalf Of Andreas Guther
> Sent: Saturday, August 14, 2004 5:39 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] Re: Log4J and Logger.getLogger practices
> 
> Stuart:
> 
> Facing the same problem I came up with the following solution:
> 
> get the Signature from thisJoinPointStaticPart get from the 
> Signature with getDeclaringType().getName() the name of the class.
> Use the className to get your logger.
> 
> This works for me but I would be interested if there is a 
> better solution.
> 
> Regards,
> 
> Andreas
> 
> 
> 
> 
> Stuart Quinn wrote:
> 
> >Good day,
> >
> >When logging with Log4J without AspectJ I define the logger based on 
> >the class name which allows me to define which classes get 
> logged in my 
> >corresponding Log4J.properties file. Easy, flexible and no 
> recompiles. 
> >It appears if I want to use AspectJ to weave in my logging I can no 
> >longer use this approach since the getLogger method is being 
> performed 
> >within the aspect. I therefore need to define within my 
> pointcut which 
> >libraries or classes I want to log (AspectJ in Action, page 159).
> >
> >Is there a way to weave in Log4J logging while retaining a 
> logger per 
> >class or per package?
> >
> >Thanks in advance for your feedback.
> >Stu
> >
> >
> >_______________________________________________
> >aspectj-users mailing list
> >aspectj-users@xxxxxxxxxxx
> >http://dev.eclipse.org/mailman/listinfo/aspectj-users
> >  
> >
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 




Back to the top