Skip to content

Commit

Permalink
Add a section about statements logging/debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mirromutth committed Dec 15, 2023
1 parent de202a7 commit 821250a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,29 @@ The default built-in `Codec`s reference table shows the type mapping between [M
| `JSON` | - | [**`String`**][java-String-ref], `Clob` |
| `GEOMETRY` | - | **`byte[]`**, `Blob` |

## Statements Logging/Debugging

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`:

```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-preparing and client-preparing. 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.

## Add a `Codec`

This is an extension of a highly customized driver behavior of encoding parameter or decoding field data.
Expand Down

0 comments on commit 821250a

Please sign in to comment.