Skip to content

Logging Statements

Mirro Mutth edited this page Feb 15, 2024 · 1 revision

Use the io.asyncer.r2dbc.mysql.QUERY logger and the DEBUG log level to log statements and their bound parameters (if it is prepared statement).

For example, in logback.xml:

<configuration>
    <!-- ... -->
    <logger name="io.asyncer.r2dbc.mysql" level="INFO"/> <!-- or DEBUG if necessary -->
    <logger name="io.asyncer.r2dbc.mysql.QUERY" level="DEBUG"/>
    <!-- ... -->
</configuration>

Note that it will print the SQL statement and all parameters, so this may be a security risk. Don't use it in an environment with sensitive data. It should be used for debugging purposes only.

The log format may be different for server preparation and client preparation. This is because the actual generated statements and commands are different in these two modes. For example, a server-preparing statement has its statement ID that's generated by server, but client-preparing does not.