Skip to content

[datasource-proxy] SLF4JSlowQueryListener issues #144

Open
@rolandkozma-sg

Description

@rolandkozma-sg

Hi,

I noticed some issues trying to configure the logging of slow-queries in our project. Please have a look.

Spring Boot: v3.3.2
datasource-proxy-spring-boot-starter: 1.11.0

Image

With the above config, I got the following logs:

2025-06-16 12:41:02.826 [pool-1-thread-1] WARN n.t.d.l.l.SLF4JSlowQueryListener
Name:dataSource, Connection:73, Time:50, Success:False
Type:Prepared, Batch:False, QuerySize:1, BatchSize:0
Query:["select ID, MAP_KEY, VALUE, ENCRYPTED, KEY_IDX, Country, Currency from adm.REG_HASH where map_key = ?"]
Params:[(value)]

2025-06-16 12:41:02.848 [http-nio-8081-exec-22] 01bf4fd0-0d5c-47bc-8ccc-c871bd4cd256 DEBUG n.t.d.l.l.SLF4JQueryLoggingListener
Name:dataSource, Connection:73, Time:72, Success:True
Type:Prepared, Batch:False, QuerySize:1, BatchSize:0
Query:["select ID, MAP_KEY, VALUE, ENCRYPTED, KEY_IDX, Country, Currency from adm.REG_HASH where map_key = ?"]
Params:[(value)]

I noticed the following issues with SLF4JSlowQueryListener that would be very useful to be fixed:

  1. the log doesn't display the correlationId ("01bf4fd0-0d5c-47bc-8ccc-c871bd4cd256").
    In contrast the SLF4JQueryLoggingListener is logging it.

  2. the Time is always capped at 50, which is the configured threshold (strangely sometimes is 49, but never greater than 50).
    In contrast, the SLF4JQueryLoggingListener probably logs the correct value (Time:72)

Image
  1. It says Success:False.
    In contrast, the SLF4JQueryLoggingListener says Success:True

  2. I expected the logs to show how many times the prepared statement is executed (because of the "count-query: true" config), but I can't see this info.

Thank you!
Roland

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions