120 Star 979 Fork 230

GVPdromara / TLog

 / 详情

在MDC模式下,@TLogAspect标签不生效

Done
Opened this issue  
2021-02-26 10:33

springcloudalibaba 工程
nacos 注册中心

消费者代码:

@GetMapping("/getData")
    @ResponseBody
    @TLogAspect({"id"})
    public List<OrderInfoDTO> getData(String id) {
        try {
            log.info("tlog test consumer : invoke method  getData {}",id);
            return dOrderInfoService.qryOrderInfos(id);
        } catch (Exception e) {
            return null;
        }
    }

生产者代码:

@TLogAspect({"id"})
    @Override
    public List<OrderInfoDTO> qryOrderInfos(String id) throws Exception {
        log.info("tlog test provider : invoke method  getData {}", id);
        List<OrderInfo> list = iOrderInfoService.list();
        List<OrderInfoDTO> resultList = new ArrayList<>();
        list.forEach(temp -> {
            OrderInfoDTO dto = new OrderInfoDTO();
            BeanUtils.copyProperties(temp, dto);
            resultList.add(dto);
        });
        return resultList;
    }

日志框架 log4j2

日志配置:

 <property name="LOG_PATTERN"
                  value="%d{yyyy-MM-dd HH:mm:ss.SSS}  %TX{tl}  [%thread]  %-5level%l %logger{0} - %msg%n"/>

日志打印效果:
2021-02-26 10:21:26.659 <0.1><8082560215233216> [DubboServerHandler-192.168.43.11:20880-thread-2] INFO com.yomahub.tlog.dubbox.filter.TLogDubboxInvokeTimeFilter.invoke(TLogDubboxInvokeTimeFilter.java:32) TLogDubboxInvokeTimeFilter - [TLOG]开始调用接口[DOrderInfoService]的方法[qryOrderInfos],参数为:["11111111"]
2021-02-26 10:21:26.701 <0.1><8082560215233216> [DubboServerHandler-192.168.43.11:20880-thread-2] INFO org.example.data.db.service.DOrderInfoServiceImpl.qryOrderInfos(DOrderInfoServiceImpl.java:26) DOrderInfoServiceImpl - tlog test provider : invoke method getData 11111111
2021-02-26 10:21:26.794 <0.1><8082560215233216> [DubboServerHandler-192.168.43.11:20880-thread-2] INFO com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:110) HikariDataSource - auth-hikari - Starting...
2021-02-26 10:21:27.002 <0.1><8082560215233216> [DubboServerHandler-192.168.43.11:20880-thread-2] INFO com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:123) HikariDataSource - auth-hikari - Start completed.
2021-02-26 10:21:27.076 <0.1><8082560215233216> [DubboServerHandler-192.168.43.11:20880-thread-2] INFO com.yomahub.tlog.dubbox.filter.TLogDubboxInvokeTimeFilter.invoke(TLogDubboxInvokeTimeFilter.java:39) TLogDubboxInvokeTimeFilter - [TLOG]结束接口[DOrderInfoService]中方法[qryOrderInfos]的调用,耗时为:460毫秒

出现问题:
没有打印出@TLogAspect({"id"})这里配置的id的值 , 麻烦问一下是我哪里配置的有问题吗?

补充:
版本号:
<tlog-all-spring-boot-starter.version>1.2.3</tlog-all-spring-boot-starter.version>
启动类增加了 Tlog 日志增加配置
代码如下:

 static {
        AspectLogEnhance.enhance();
    }

Comments (5)

不温不火 created任务
不温不火 set related repository to bryan31/TLog
不温不火 changed description
展开全部操作日志

@不温不火 目前版本TLogAspect在controller层面标注是不生效的,这个问题有待修复,请等待下一个版本

好的,谢谢了, 冒昧问一下还要多久呢。挺期待的。

@不温不火 在主页上加群或者加好友,大概1,2天。好了我会在群里通知

@不温不火 我测试了下,这个其实已经在之前修复了。我这里是好的。最好加下群,可以细致交流,帮助改善

铂赛东 changed title
铂赛东 set assignee to 铂赛东
铂赛东 added
 
bug
label
铂赛东 set priority to Secondary
铂赛东 changed issue state from 待办的 to 已拒绝
铂赛东 changed issue state from 已拒绝 to 已完成

Sign in to comment

状态
Assignees
Milestones
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
Branches
Planed to start   -   Planed to end
-
Top level
Priority
参与者(2)
1102362 bryan31 1578940308 887650 gslxyzdhm 1618975840
Java
1
https://gitee.com/dromara/TLog.git
git@gitee.com:dromara/TLog.git
dromara
TLog
TLog

Search