Skip to content

Integrate with Quartz to output empty SQL #146

Open
@ferrymo

Description

@ferrymo

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 !!!

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