spring-boot-data-source-decorator icon indicating copy to clipboard operation
spring-boot-data-source-decorator copied to clipboard

Integrate with Quartz to output empty SQL

Open ferrymo opened this issue 5 months ago • 0 comments

ENV

jdk21 和Springboot 3.4.5

dependencies

<dependency>
    <groupId>com.github.gavlyukovskiy</groupId>
    <artifactId>p6spy-spring-boot-starter</artifactId>
    <version>1.11.0</version>
</dependency>

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-quartz</artifactId>
        <version>3.4.5</version>
      </dependency>

application.yaml

decorator:
  datasource:
    p6spy:
      enable-logging: true
      log-format: "[executionTime]:%(executionTime) ms  [sql]:%(sqlSingleLine)\n"
      log-filter:
        pattern: ^(?!.*(QRTZ_|\[sql\]:\s*$)).+$ 

spring:
  quartz:
    auto-startup: true 
    scheduler-name: schedulerName
    job-store-type: jdbc
    wait-for-jobs-to-complete-on-shutdown: true
    properties:
      org:
        quartz:
          scheduler:
            instanceName: schedulerName
            instanceId: AUTO 
          jobStore:
            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
            isClustered: true 
            clusterCheckinInterval: 1800000 
            misfireThreshold: 1800000
          threadPool:
            threadCount: 2
            threadPriority: 5
            class: org.quartz.simpl.SimpleThreadPool
    jdbc: 
      initialize-schema: NEVER 

console

2025-06-25 16:42:51.844 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:43:16.713 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:43:40.213 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:44:05.266 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:44:31.757 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:44:56.495 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:1 ms  [sql]:

2025-06-25 16:45:20.436 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:45:46.401 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:5 ms  [sql]:

2025-06-25 16:46:13.344 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:46:41.241 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:47:08.273 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

2025-06-25 16:47:32.997 |  INFO 59304 | schedulerName_QuartzSchedulerThread [TID: N/A] p6spy                                    | [executionTime]:0 ms  [sql]:

expectation

Do not output empty SQL !!!

ferrymo avatar Jun 25 '25 08:06 ferrymo