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

[BUG] demo-orm-jdbctemplate 中,日志打印问题 #233

Open
zornx5 opened this issue Aug 30, 2022 · 3 comments
Open

[BUG] demo-orm-jdbctemplate 中,日志打印问题 #233

zornx5 opened this issue Aug 30, 2022 · 3 comments
Assignees
Labels
bug 错误

Comments

@zornx5
Copy link

zornx5 commented Aug 30, 2022

描述问题

在日志打印 SQL 参数时,基本数据类型使用 JSONUtil.toJsonStr() 无法 JSON 序列化,导致日志打印内容为空

  • deleteById()
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】SQL:DELETE FROM `orm_user` where id = ?
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】参数:{}
  • 以及 findOneById()
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】SQL:SELECT * FROM `orm_user` where id = ?
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】参数:{}

期待的结果

  • deleteById(1)
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】SQL:DELETE FROM `orm_user` where id = ?
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】参数:1
  • 以及 findOneById(1)
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】SQL:SELECT * FROM `orm_user` where id = ?
c.x.orm.jdbctemplate.dao.base.BaseDao    : 【执行SQL】参数:1

截屏或录像

改进建议

此处参数数量仅为 1,打印时无需使用 JSONUtil.toJsonStr(),直接打印即可

如:log.debug("【执行SQL】参数:{}", JSONUtil.toJsonStr(pk)); -> log.debug("【执行SQL】参数:{}", pk);

@zornx5 zornx5 added the bug 错误 label Aug 30, 2022
@zhanzhao-h
Copy link

我来提一个fix 这个issues

@guxiren
Copy link

guxiren commented Dec 22, 2022 via email

@zhanzhao-h
Copy link

zhanzhao-h commented Dec 29, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 错误
Projects
None yet
Development

No branches or pull requests

4 participants