问题描述
我有一个Spring Boot应用程序,我正在尝试添加比这更好的数据库日志记录
I have a Spring boot app I'm trying to add database logging to which is better than
spring.jpa.properties.hibernate.show_sql=true
log4jdbc,来自
log4jdbc, from
https://github.com/marcosemiao/log4jdbc
似乎是最新的分叉器,格式似乎很好,可以填写参数并添加计时,正是我想要的.
seems to be the most up to date fork around, seems to format nicely, fills in parameters and adds timing, exactly what I want.
但是当我按照自述文件中的说明进行配置时,请更改
But when I configure it as stated in the readme, changing
spring.datasource.url=jdbc:mysql://localhost:3306/coindatabase?useSSL=false
到
spring.datasource.url=jdbc:log4jdbc:mysql://localhost:3306/coindatabase?useSSL=false
似乎有些东西不喜欢我对mysql的引用,并且似乎尝试回退到H2:
something seems to not like my reference to mysql and seems to try to fall back to H2:
Caused by: java.lang.RuntimeException: Driver org.h2.Driver claims to not accept jdbcUrl, jdbc:log4jdbc:mysql://localhost:3306/coindatabase?useSSL=false
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:106)
是否有一些简单的方法可以使它们一起工作?
Is there some easy way to make this work together?
推荐答案
log4jdbc(用于春季启动包装程序)
log4jdbc for spring boot wrapper:
<groupId>com.integralblue</groupId>
<artifactId>log4jdbc-spring-boot-starter</artifactId>
似乎是从以下方面引入实现的:
which seems to pull in the implementation from:
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
这篇关于log4jdbc可以与spring boot一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!