Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

日志输出格式化了2次 #2128

Closed
ghostoy opened this issue Jul 18, 2022 · 6 comments
Closed

日志输出格式化了2次 #2128

ghostoy opened this issue Jul 18, 2022 · 6 comments
Assignees
Labels
No update status for a long time No update status for a long time type: bug for issue something isn't working

Comments

@ghostoy
Copy link
Contributor

ghostoy commented Jul 18, 2022

  • Node Version: 18.5.0
  • Midway Version(Decorator/Core): 3.3.6
  • Component Name/Version: @midwayjs/[email protected]
  • Platform:
  • Mini Showcase Repository:
logger.info('%s', '%Y-%m-%d')
// 应该输出
// %Y-%m-%d
// 实际输出
// %Y-%m-NaN

在@midwayjs/logger中使用util.format%s部分格式化一遍,然后到了winston里又被splat格式化了一遍,导致日志中输出错误。

@ghostoy
Copy link
Contributor Author

ghostoy commented Jul 18, 2022

@midwayjs/logger上也提交了相同的issue (midwayjs/logger#62)

@czy88840616
Copy link
Member

czy88840616 commented Jul 18, 2022

日志里要打 % 格式的内容?

@ghostoy
Copy link
Contributor Author

ghostoy commented Jul 18, 2022

日志里要打 % 格式的内容?

是的

@ghostoy
Copy link
Contributor Author

ghostoy commented Jul 26, 2022

@czy88840616 你们会修复吗,我提交了PR (midwayjs/logger#63)

@waitingsong
Copy link
Member

需要用 % 在后续日志中继续解析? 会不会有安全问题(好比 log4j 那种)

@czy88840616
Copy link
Member

@ghostoy 我把单测修了下,可以先 rebase 下master

@czy88840616 czy88840616 self-assigned this Aug 8, 2022
@czy88840616 czy88840616 added the type: bug for issue something isn't working label Aug 8, 2022
@czy88840616 czy88840616 added the No update status for a long time No update status for a long time label Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No update status for a long time No update status for a long time type: bug for issue something isn't working
Development

No branches or pull requests

3 participants