• 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.

Pastime mindset | Seth’s Weblog

Time journey | Seth’s Weblog

November 8, 2025
Examine reveals AI coding assistants really decelerate skilled builders

Examine reveals AI coding assistants really decelerate skilled builders

July 14, 2025

Trending.

The right way to Defeat Imagawa Tomeji

The right way to Defeat Imagawa Tomeji

September 28, 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
Satellite tv for pc Navigation Methods Going through Rising Jamming and Spoofing Assaults

Satellite tv for pc Navigation Methods Going through Rising Jamming and Spoofing Assaults

March 26, 2025
Exporting a Material Simulation from Blender to an Interactive Three.js Scene

Exporting a Material Simulation from Blender to an Interactive Three.js Scene

August 20, 2025
Introducing Sophos Endpoint for Legacy Platforms – Sophos Information

Introducing Sophos Endpoint for Legacy Platforms – Sophos Information

August 28, 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

Home windows Malware Makes use of Pulsar RAT for Stay Chats Whereas Stealing Knowledge – Hackread – Cybersecurity Information, Knowledge Breaches, AI, and Extra

Home windows Malware Makes use of Pulsar RAT for Stay Chats Whereas Stealing Knowledge – Hackread – Cybersecurity Information, Knowledge Breaches, AI, and Extra

February 1, 2026
AI brokers now have their very own Reddit-style social community, and it is getting bizarre quick

AI brokers now have their very own Reddit-style social community, and it is getting bizarre quick

February 1, 2026
  • 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