97e0d49c by 李墨

[fix]:修复日志打印

1 parent a0cfa949
...@@ -35,11 +35,11 @@ public class OperateLogAspect implements Ordered { ...@@ -35,11 +35,11 @@ public class OperateLogAspect implements Ordered {
35 String className = joinPoint.getTarget().getClass().getName(); 35 String className = joinPoint.getTarget().getClass().getName();
36 String methodName = joinPoint.getSignature().getName(); 36 String methodName = joinPoint.getSignature().getName();
37 Object[] args = joinPoint.getArgs(); 37 Object[] args = joinPoint.getArgs();
38 LOG.info("========================================"); 38 LOG.info("================== 操作日志打印 start ======================");
39 LOG.info(" 操作日志打印:调用 {} {} 方法,请求参数:{}",className,methodName,args); 39 LOG.info("\t调用 {} {} 方法,请求参数:{}",className,methodName,args);
40 Object result = joinPoint.proceed(args); 40 Object result = joinPoint.proceed(args);
41 LOG.info(" 操作日志打印:{} {} 方法,返回结果:{}",result); 41 LOG.info("\t{} {} 方法,返回结果:{}",className,methodName,result);
42 LOG.info("========================================"); 42 LOG.info("================== 操作日志打印 end ======================");
43 return result; 43 return result;
44 } 44 }
45 45
......
1 package com.seektruth.demo.spring.boot.resilience4j.service.impl; 1 package com.seektruth.demo.spring.boot.resilience4j.service.impl;
2 2
3 import com.seektruth.demo.spring.boot.resilience4j.controller.BaseController;
3 import com.seektruth.demo.spring.boot.resilience4j.service.BusinessService; 4 import com.seektruth.demo.spring.boot.resilience4j.service.BusinessService;
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
4 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
5 8
6 import java.util.concurrent.ThreadLocalRandom; 9 import java.util.concurrent.ThreadLocalRandom;
...@@ -12,6 +15,8 @@ import java.util.concurrent.TimeUnit; ...@@ -12,6 +15,8 @@ import java.util.concurrent.TimeUnit;
12 @Service 15 @Service
13 public class BusinessServiceImpl implements BusinessService { 16 public class BusinessServiceImpl implements BusinessService {
14 17
18 private static final Logger LOG = LoggerFactory.getLogger(BusinessServiceImpl.class);
19
15 @Override 20 @Override
16 public String query() { 21 public String query() {
17 randomSleep(); 22 randomSleep();
...@@ -25,6 +30,6 @@ public class BusinessServiceImpl implements BusinessService { ...@@ -25,6 +30,6 @@ public class BusinessServiceImpl implements BusinessService {
25 } catch (InterruptedException e) { 30 } catch (InterruptedException e) {
26 e.printStackTrace(); 31 e.printStackTrace();
27 } 32 }
28 System.out.println("当前业务处理时长:"+time+"秒"); 33 LOG.info("\t当前业务处理时长:{}秒", time);
29 } 34 }
30 } 35 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!