minbox-projects / minbox-logging

分布式零侵入式、链路式请求日志分析框架。提供Admin端点进行采集日志、分析日志、日志告警通知、服务性能分析等。通过Admin Ui可查看实时链路日志信息、在线业务服务列表。
https://www.minbox.org/logging/
Apache License 2.0
59 stars 26 forks source link

log admin管理界面查看到的日志与后台打印的请求日志不符,如globalLogs等内容没有 #14

Open randeexiong opened 1 year ago

randeexiong commented 1 year ago

后台输出的日志内容

2022-09-17 22:25:07.918  INFO 24376 --- [io-1224-exec-10] o.m.f.l.a.l.ReportLogJsonFormatListener  : Receiving Service: 【cbrc-statment-verify-services -> 192.168.221.2】, Request Log Report,Logging Content:[ {
  "traceId" : "602654081907957760",
  "spanId" : "602654081907957760",
  "parentSpanId" : null,
  "requestUri" : "/httpTest/testCustTranInfoService",
  "requestMethod" : "POST",
  "httpStatus" : 200,
  "requestIp" : "0:0:0:0:0:0:0:1",
  "serviceIp" : "192.168.221.2",
  "servicePort" : "1989",
  "startTime" : 1663424707706,
  "endTime" : 1663424707761,
  "timeConsuming" : 55,
  "serviceId" : "cbrc-statment-verify-services",
  "requestHeaders" : {
    "content-length" : "0",
    "postman-token" : "fb90869b-8868-4e20-b96f-3b8e30b93456",
    "host" : "localhost:1989",
    "content-type" : "application/json",
    "connection" : "keep-alive",
    "accept-encoding" : "gzip, deflate, br",
    "user-agent" : "PostmanRuntime/7.29.0",
    "accept" : "*/*"
  },
  "requestParam" : "{}",
  "requestBody" : "",
  "responseHeaders" : { },
  "responseBody" : "",
  "exceptionStack" : null,
  "globalLogs" : [ {
    "level" : "info",
    "content" : "test",
    "exceptionStack" : null,
    "callerClass" : "org.minbox.framework.api.boot.cbrc.stateverify.service.CustTranInfoService",
    "callerMethod" : "findTranInfoByParams",
    "callerCodeLineNumber" : 56,
    "createTime" : 1663424707707
  } ]
} ]

logging admin web页面查看到的显示日志内容

{
    "spanId": "602654081907957760",
    "parentSpanId": null,
    "requestIp": "0:0:0:0:0:0:0:1",
    "serviceIp": "192.168.221.2",
    "servicePort": "1989",
    "startTime": 1663424707706,
    "endTime": 1663424707761,
    "requestHeaders": null,
    "requestParam": "{}",
    "requestBody": "",
    "responseHeaders": null,
    "responseBody": "",
    "exceptionStack": null,
    "globalLogs": null,
    "requestHeader": "{\"content-length\":\"0\",\"postman-token\":\"fb90869b-8868-4e20-b96f-3b8e30b93456\",\"host\":\"localhost:1989\",\"content-type\":\"application/json\",\"connection\":\"keep-alive\",\"accept-encoding\":\"gzip, deflate, br\",\"user-agent\":\"PostmanRuntime/7.29.0\",\"accept\":\"*/*\"}",
    "responseHeader": "{}"
}
randeexiong commented 1 year ago

看了下源代码,org.minbox.framework.logging.admin.storage.LoggingDataSourceStorage#insertLog 有些日志请求没有写入到数据库中,比如globalLogs就没有写入,所以看到的才不同,是有什么考虑吗?