log4jdbc可以和spring boot一起使用吗?

问题描述 投票:0回答:1

我有一个Spring启动应用程序我正在尝试添加更好的数据库日志记录

spring.jpa.properties.hibernate.show_sql=true

log4jdbc,来自

https://github.com/marcosemiao/log4jdbc

似乎是最新的解决方案,似乎格式很好,填写参数并添加时间,正是我想要的。

但是,当我按照自述文件中的说明进行配置时,更改

spring.datasource.url=jdbc:mysql://localhost:3306/coindatabase?useSSL=false

spring.datasource.url=jdbc:log4jdbc:mysql://localhost:3306/coindatabase?useSSL=false

似乎不喜欢我对mysql的引用,似乎试图回到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)

是否有一些简单的方法使这项工作在一起?

mysql spring-boot log4jdbc
1个回答
1
投票

log4jdbc for spring boot wrapper:

<groupId>com.integralblue</groupId>
<artifactId>log4jdbc-spring-boot-starter</artifactId>

这似乎从实施中获取:

<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
© www.soinside.com 2019 - 2024. All rights reserved.