• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

How you can log all SQL statements executed by R2DBC

Admin by Admin
May 8, 2025
Home Coding
Share on FacebookShare on Twitter


jOOQ already has a LoggingConnection (see additionally the handbook), which acts as a JDBC proxy Connection to log all SQL statements which can be executed by any JDBC shopper (together with Hibernate, MyBatis, JdbcTemplate, native JDBC, and so on.).

Ranging from jOOQ 3.18.0, 3.17.7, and three.16.13, a LoggingConnection is now additionally obtainable for R2DBC purchasers to log all reactive queries. Whereas some R2DBC drivers already do their very own DEBUG logging, a few of them don’t, so this utility might be very helpful to jOOQ customers or anybody else working with R2DBC.

When you don’t wish to add the jOOQ dependency, you possibly can merely use the LoggingConnection code obtainable from github. To provide you an thought of what it does:

// The jOOQ DefaultConnection simply delegates all calls 
// to a delegate Connection
public class LoggingConnection extends DefaultConnection {

    // Use your individual logger, alternatively
    personal static closing JooqLogger log = 
        JooqLogger.getLogger(LoggingConnection.class);

    public LoggingConnection(Connection delegate) {
        tremendous(delegate);
    }

    @Override
    public Writer shut() {
        return s -> {
            if (log.isDebugEnabled())
                log.debug("Connection::shut");

            getDelegate().shut().subscribe(s);
        };
    }

    @Override
    public Assertion createStatement(String sql) {
        if (log.isDebugEnabled())
            log.debug("Connection::createStatement", sql);

        return new LoggingStatement(getDelegate().createStatement(sql));
    }

    // [...]
}

And the identical factor is completed with a wrapper for Assertion or Batch:

// The jOOQ DefaultStatement simply delegates all calls 
// to a delegate Assertion
public class LoggingStatement extends DefaultStatement {

    // Use your individual logger, alternatively
    personal static closing JooqLogger log = 
        JooqLogger.getLogger(LoggingStatement.class);

    public LoggingStatement(Assertion delegate) {
        tremendous(delegate);
    }

    @Override
    public Assertion add() {
        if (log.isDebugEnabled())
            log.debug("Assertion::add");

        getDelegate().add();
        return this;
    }

    @Override
    public Writer extends End result> execute() {
        return s -> {
            if (log.isDebugEnabled())
                log.debug("Assertion::execute");

            getDelegate().execute().subscribe(s);
        };
    }
}

That’s it!

Like this:

Like Loading…

Revealed by lukaseder

I made jOOQ
View all posts by lukaseder

Tags: executedlogR2DBCSQLstatements
Admin

Admin

Next Post
Minecraft Film 4K Blu-Ray & Digital Launch Dates Revealed – Steelbook Preorders In Inventory

Minecraft Film 4K Blu-Ray & Digital Launch Dates Revealed - Steelbook Preorders In Inventory

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

Person interplay design drives outcomes

Simply the best size | Seth’s Weblog

May 28, 2025
WebGPU Scanning Impact with Depth Maps

WebGPU Scanning Impact with Depth Maps

April 1, 2025

Trending.

Industrial-strength April Patch Tuesday covers 135 CVEs – Sophos Information

Industrial-strength April Patch Tuesday covers 135 CVEs – Sophos Information

April 10, 2025
Expedition 33 Guides, Codex, and Construct Planner

Expedition 33 Guides, Codex, and Construct Planner

April 26, 2025
How you can open the Antechamber and all lever places in Blue Prince

How you can open the Antechamber and all lever places in Blue Prince

April 14, 2025
Important SAP Exploit, AI-Powered Phishing, Main Breaches, New CVEs & Extra

Important SAP Exploit, AI-Powered Phishing, Main Breaches, New CVEs & Extra

April 28, 2025
Wormable AirPlay Flaws Allow Zero-Click on RCE on Apple Units by way of Public Wi-Fi

Wormable AirPlay Flaws Allow Zero-Click on RCE on Apple Units by way of Public Wi-Fi

May 5, 2025

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

What’s going to influencer advertising and marketing appear to be in 2025? Knowledgeable predictions + new knowledge

What’s going to influencer advertising and marketing appear to be in 2025? Knowledgeable predictions + new knowledge

June 18, 2025
Yoast AI Optimize now out there for Basic Editor • Yoast

Replace on Yoast AI Optimize for Traditional Editor  • Yoast

June 18, 2025
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved