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.

My next events:
🗓 May 27 09:00 AWS Dublin - Micronaut and AWS Lambda
🗓 Jul 20 09:00 Workshop Security in the Micronaut Framework
🗓 Sep 20 09:00 JCON Online 2022 - Getting Started with the Micronaut Framework
🗓 Sep 23 09:00 JCON Online 2022 - Micronaut® Framework and Microstream Java-native persistence engine

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
Oct 2021, 21.