1

Topic: Spring AOP: aspect on method performance in the interface

Help to make a spell. I want to intercept calls org.slf4j. Logger.info (String s) in the packet com.mycompany.myproject. I begin with a simple variant which works: @Around ("target (org.slf4j. Logger)") public Object aroundLogging (ProceedingJoinPoint pjp) throws Throwable {String info = (String) pjp.getArgs () [0]; System.out.println ("###" +info); return pjp.proceed ();} I Try to add method performance info: @Around ("target (org.slf4j. Logger) && execution (* info (.))") public Object aroundLogging (ProceedingJoinPoint pjp) throws Throwable {String info = (String) pjp.getArgs () [0]; System.out.println ("###" +info); return pjp.proceed ();}//Writes  that ADviseDidNotMatch If so (instead of info I put *): @Around ("target (org.slf4j. Logger) && execution (* info (.) ) ") public Object aroundLogging (ProceedingJoinPoint pjp) throws Throwable {String info = (String) pjp.getArgs () [0]; System.out.println ("###"+info); return pjp.proceed ();}//Compile OK. But in  here I do not get the Variant org.slf4j. Logger +, that is @Around (" target (org.slf4j. Logger +) && execution (* info (.)) ") does not help

2

Re: Spring AOP: aspect on method performance in the interface

Hello, purser, you wrote: P> Help to make a spell. I want to intercept calls org.slf4j. Logger.info (String s) in the packet com.mycompany.myproject. Springovye aspects will work only with those bins which created itself . Variants, likely, the such: * to Make the  and to palm off it , well further already  where it is necessary. * to Write the filter for logback (or in log4j) or  to them in  the . * Well or  it is possible the agent, but as a last resort.

3

Re: Spring AOP: aspect on method performance in the interface

Hello, StanislavK, you wrote: P>> Help to make a spell. I want to intercept calls org.slf4j. Logger.info (String s) in the packet com.mycompany.myproject. SK> aspects will work as Springovye only with those bins which created itself . I so understood  at purser  a bin of times the first variant works.

4

Re: Spring AOP: aspect on method performance in the interface

at me form by normal image in each class: @Controller public class UploadController {private static final Logger logger = LoggerFactory.getLogger (UploadController.class);//skipped} At such summary in aspect (which all the same works) @Around ("target (org.slf4j. Logger)") public Object aroundLogging (ProceedingJoinPoint pjp) throws Throwable {//skipped} the project  very long and Eclipse designates "hook" almost each line in source codes. Hello, GarryIV, you wrote: GIV> Hello, StanislavK, you wrote: P>>> Help to make a spell. I want to intercept calls org.slf4j. Logger.info (String s) in the packet com.mycompany.myproject. SK>> aspects will work as Springovye only with those bins which created itself . GIV> I so understood  at purser  a bin of times the first variant works.

5

Re: Spring AOP: aspect on method performance in the interface

Hello, purser, you wrote: P> Loggery at me form by normal image in each class: P> [java] P>@Controller P> public class UploadController {P> private static final Logger logger = LoggerFactory.getLogger (UploadController.class); P>//skipped Then it is not necessary to you of aspects - do as StanislavK wrote

6

Re: Spring AOP: aspect on method performance in the interface

If it is possible, explain on the first point... "To make the  and to palm off it , well further already  where it is necessary." Hello, GarryIV, you wrote: GIV> Hello, purser, you wrote: P>> Loggery at me form by normal image in each class: P>> [java] P>>@Controller P>> public class UploadController {P>> private static final Logger logger = LoggerFactory.getLogger (UploadController.class); P>>//skipped GIV> Then it is not necessary to you of aspects - do as StanislavK wrote

7

Re: Spring AOP: aspect on method performance in the interface

Hello, purser, you wrote: P> If it is possible, explain on the first point... P> "to Make the  and to palm off it , well further already  where it is necessary." Most partially  slf4j interfaces for : http://www.slf4j.org/manual.html#swapping