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

Pokémon TCG Pocket meta, finest decks for April 2025

Pokémon TCG Pocket meta, finest decks for April 2025

April 8, 2025
Bleach Rebirth of Souls Assessment

Bleach Rebirth of Souls Assessment

March 29, 2025

Trending.

Microsoft Launched VibeVoice-1.5B: An Open-Supply Textual content-to-Speech Mannequin that may Synthesize as much as 90 Minutes of Speech with 4 Distinct Audio system

Microsoft Launched VibeVoice-1.5B: An Open-Supply Textual content-to-Speech Mannequin that may Synthesize as much as 90 Minutes of Speech with 4 Distinct Audio system

August 25, 2025
Begin constructing with Gemini 2.0 Flash and Flash-Lite

Begin constructing with Gemini 2.0 Flash and Flash-Lite

April 14, 2025
New Assault Makes use of Home windows Shortcut Information to Set up REMCOS Backdoor

New Assault Makes use of Home windows Shortcut Information to Set up REMCOS Backdoor

August 3, 2025
The most effective methods to take notes for Blue Prince, from Blue Prince followers

The most effective methods to take notes for Blue Prince, from Blue Prince followers

April 20, 2025
Menace Actors Use Pretend DocuSign Notifications to Steal Company Information

Menace Actors Use Pretend DocuSign Notifications to Steal Company Information

May 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

Microsoft Brings MCP to Azure Logic Apps (Customary) in Public Preview, Turning Connectors into Agent Instruments

Microsoft Brings MCP to Azure Logic Apps (Customary) in Public Preview, Turning Connectors into Agent Instruments

September 23, 2025
6 Greatest Worker Engagement Software program: My Analysis

6 Greatest Worker Engagement Software program: My Analysis

September 23, 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