0

I want to get traces following logs

{
    @Aspect    
    @Component    
    public class AspectJPay {

        private static final Logger log = LoggerFactory.getLogger(AxiPayCustomerController.class);

        @Before("execution(* lk.ideahub.symphony.controller.axipay.customer.AxiPayCustomerController.*(..))")
        public void logBefore(JoinPoint joinPoint) {
            Date date = new Date();
            String strDateFormat = "hh:mm:ss a";
            DateFormat dateFormat = new SimpleDateFormat(strDateFormat);
            String formattedDate = dateFormat.format(date);
            log.info("Current Start time Time is : {} {}", formattedDate, joinPoint.getSignature().getName());
            System.out.println("Current time of the day using Date - 12 hour format: " + formattedDate);
        }

        @After("execution(* lk.ideahub.symphony.controller.axipay.customer.AxiPayCustomerController.*(..))")
        public void logAfter(JoinPoint joinPoint) {
            Date date = new Date();
            String strDateFormat = "hh:mm:ss a";
            DateFormat dateFormat = new SimpleDateFormat(strDateFormat);
            String formattedDate = dateFormat.format(date);
            log.info("Current End Time is : {} {}", formattedDate, joinPoint.getSignature().getName());
            System.out.println("Current time of the day using Date - 12 hour format: " + formattedDate);
        }
    }
}

But non of the logs getting traced. did anyone know why i`m wrong or i want to know the actual gradle dependencies which want to import

Please help me Thanks.

JAM
  • 6,045
  • 1
  • 32
  • 48
Das_J
  • 71
  • 2
  • 9
  • Formatted code. – JAM May 30 '19 at 19:11
  • Check the log level. Check if it even enters the code.. – DanielM May 30 '19 at 19:31
  • It is kind of difficult to find out why your aspect does not work as expected if you don't show the target class and also the Spring configuration. And please add package names to both aspect and application class if you post something. You use package names in your pointcuts, so they are important. Bottom line: Please post an [MCVE](http://stackoverflow.com/help/mcve) on StackOverflow whenever possible. Then people can help you better. Otherwise answers are just speculation. – kriegaex May 31 '19 at 01:19
  • And BTW, you wrote that the log output is not triggered. You didn't say anything about the `System.out.println(..)` calls. Can you see their output? If you do, it means the aspect works and the logging is misconfigured. If you don't it means the aspect or its configuration are wrong. – kriegaex May 31 '19 at 01:21
  • Dear Friends, Finally i figure out its fault which is in my @Before execution point cut path.Thanks for the help. I did the task using Spring AOP, but now tech group asking it using AspectJ – Das_J Jun 03 '19 at 06:04

0 Answers0