Open abhishekjoy1 opened 2 months ago
@abhishekjoy1 this starter sets slf4j logging by default, so the logfile should not be created. Can you please send minimal example that reproduces the issue?
I am also facing a similar issue. I have a sample spring boot app using p6spy-spring-boot-starter with the following configuration in the application.yml file:
decorator.datasource:
p6spy:
enable-logging: false
The spy.log file is generated at every app startup. How can I disable the log file being generated? I am no interested in the logging functionalities of the p6spy library.
@grove693 if you can, please provide some minimal project where this problem can be reproduced. Otherwise nothing comes to my mind that could cause it
@gavlyukovskiy The cause to this behavior was the mismatch between the versions of Spring Boot and p6spy-spring-boot-starter.
I was using Spring Boot v. 2.7.12 and the newest version of p6spy-spring-boot-starter (1.9.2). What I found out is that for some reason, the P6SpyConfiguration bean (where the library properties are processed) was not initialized in the Spring Context. Whenever I would start the app the spy.log file would be created that logged all the queries The custom defined SimpleJdbcEventListener worked fine though.
I then switched to the following configuration: Spring Boot v. 2.7.12 and p6spy-spring-boot-starter v 1.8.1 and it worked smoothly (the properties were being read by the library).
Is there a version of p6spy-spring-boot-starter that works well with both Spring Boot v 2.x and v 3.x ? I'm working on a monitoring library that's using p6spy-spring-boot-starter to intercept JDBC calls and would want to avoid the situation where a random log file (the spy.log file) would be generated for the clients who are also using Spring Boot v 2.x
If you still need a sample repository with the minimal config to reproduce this issue let me know .
@gavlyukovskiy Added the minimal project here:
Thanks for doing some research on the issue! From the point of support of 2.7 and 3.x, it is quite difficult because of different java baselines, so I wont be releasing 1.8.x branch, but if you're willing to make an MR to make 1.9.x compatible with speing boot 2.7, then I'd accept that :+1:
For anyone having similar issues, I have disabled the logging by configuring the P6Spy framework itself. I created a spy.properties file with the following content
modulelist=com.p6spy.engine.spy.P6SpyFactory
This might impact some functionalities of p6spy-spring-boot-starter, however the JdbcEventListeners still work fine (which is what I need for my use case).
I’m using
p6spy-spring-boot-starter
in my Spring Boot application to analyze MySQL queries. I’ve added the following dependencies in my pom.xml:In my
application.properties
, I’ve included the following property because I don’t want to generate any logs; instead, I want to set up monitoring based on captured metrics.Additionally, I’ve created a custom JDBC event listener to capture metrics:
I’m injecting this listener using the following configuration:
However, when I start the application, I get the following error:
Despite setting
decorator.datasource.p6spy.enable-logging=false
, the application seems to be trying to create aspy.log
file, which I don't want.Any help would be greatly appreciated!