You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"level":"WARN","date":"2023-02-15 09:15:30,242","pid":88174,"hostname":"xxx","message":"[ClusterClient:Watcher] follower closed, and try to init it again"}
Activity
fengmk2 commentedon Feb 14, 2023
你是怎样拿到这个数据的?
sjfkai commentedon Feb 15, 2023
把日志配置改成JSON config.default.js:
日志输出 egg-web.json.log:
{"level":"WARN","date":"2023-02-15 09:15:30,242","pid":88174,"hostname":"xxx","message":"[ClusterClient:Watcher] follower closed, and try to init it again"}看了一下 egg-logger 源码:
meta.date = utility.logDate(',')类似moment().format('YYYY-MM-DD HH:mm:ss.SSS')fengmk2 commentedon Feb 15, 2023
嗯,这里确实是一个问题,默认的是当前服务器所在时区的 local 时间。可以新增一个选型,输出 Date 标准的 JSON 格式。
fengmk2 commentedon Feb 15, 2023
@sjfkai 来尝试pr实现?
sjfkai commentedon Mar 1, 2023
@fengmk2 其实跟 JSON 的关系不大,默认输出的 Data 也有相同问题。
新的选项如何命名有什么建议吗?
dateISOFormat: true?实现上就用
Date.prototype.toISOString()替换当前的utility.logDate?fengmk2 commentedon Mar 1, 2023
可以的。
feat: add dateISOFormat option (#88)