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

datasource-proxy slow-query logging doesn't work as expected #128

Open
rolandkozma-sg opened this issue Mar 7, 2025 · 1 comment
Open

Comments

@rolandkozma-sg
Copy link

rolandkozma-sg commented Mar 7, 2025

Hi,
I'm using datasource-proxy-spring-boot-starter 1.8.1 with spring boot 2.5.15.
Beside adding the above dependency, I also configured:
decorator.datasource.datasource-proxy.query.log-level=INFO
Then I started to see the queries logged at the info level, as expected.

However, I wasn't able to configure slow-queries to be logged using the properties:
decorator.datasource.datasource-proxy.slow-query.enable-logging=true
decorator.datasource.datasource-proxy.slow-query.log-level=WARN
decorator.datasource.datasource-proxy.slow-query.threshold=50

I'd like to log at WARN level all the queries that took longer than 50 milliseconds (although the doc says that the threshold property value is in seconds, I think that's a mistake).
After adding the above slow-query configs I still see all the logs at INFO level including the queries with longer execution time than 50 ms.
The only way I'm able to see logs at WARN level is to set the threshold to 0. Then all the logs will be with WARN.
My goal is to log only slow-queries at WARN level. Please help.

Regards,
Roland

@pcomp96
Copy link

pcomp96 commented Mar 27, 2025

Same problem for us :

SpringBoot 3.4.3
datasource-proxy-spring-boot-starter.version = 1.10.0

This our config:

decorator:
  datasource:
    enabled: true #Enable the decorator
    datasource-proxy:
      # Use only one of this
      multiline: false
      json-format: false
      format-sql: true
      slow-query:
        enable-logging: true
        threshold: 300 #Default threshold value Log for slow query
        log-level: WARN #default
      query:
        enable-logging: true #default
        log-level: DEBUG #default

I have the slow query (305 over my threshold) logged on SLF4JQueryLoggingListener

2025-03-27 15:02:38.291 DEBUG 73 --- [x-pool-1] [67e5688dcf1ec74a0fb65d84006455ba-57ebbe8fcae5f5c9] n.t.d.l.l.SLF4JQueryLoggingListener : Name:main, Connection:163845, Time:305, Success:True, Type:Prepar....

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

No branches or pull requests

2 participants