Log Micronaut® Data queries

I often add this logger to log my queries when using Micronaut Data.

src/main/resources/logback.xml

    <logger name="io.micronaut.data.query" level="TRACE"/>
</configuration>

Then, you will get an output such as:

Executing SQL Insert: INSERT INTO `contact` (`name`,`job_title`,`id`) VALUES (?,?,?)
Binding parameter at position 1 to value Tim Cook with data type: STRING
Binding parameter at position 2 to value CEO with data type: STRING
Binding parameter at position 3 to value Df6saLdgrlItF6IB9C6tU2r9Bvg with data type: STRING

It is important to get visibility about the queries your application is executing.

Micronaut® is a registered trademark of Object Computing, Inc. Use is for referential purposes and does not imply any endorsement or affiliation with any third-party product. Unauthorized use is strictly prohibited.

Tags: #micronaut #micronautdata