Backend Development 3 min read

How to Install and Use MyBatis Log Plugin to Generate Executable SQL Statements

This guide explains why the MyBatis Log Plugin is useful for converting MyBatis console SQL logs into ready‑to‑run statements, and provides step‑by‑step instructions for installing the plugin in IntelliJ IDEA, activating it, and configuring log levels for proper operation.

Top Architecture Tech Stack
Top Architecture Tech Stack
Top Architecture Tech Stack
How to Install and Use MyBatis Log Plugin to Generate Executable SQL Statements

MyBatis is a popular Java framework for database access, but its default SQL logs are not directly executable, requiring manual concatenation.

The MyBatis Log Plugin transforms these logs into complete, executable SQL statements that can be copied and run immediately, simplifying debugging and verification.

To install, add the plugin in IntelliJ IDEA and restart the IDE.

After installation, activate the plugin via the Tools menu or the shortcut Ctrl+Alt+Shift+O.

When the application runs, the plugin restores the original SQL from MyBatis logs, displaying it in the console as ready‑to‑execute statements.

If no SQL appears, ensure the log level is set to debug and, for Spring Boot projects, add the following configuration to application.yml :

logging:level:com.cd.o2o2.dao: debug   #com.cd.o2o2.dao is the path of your DAO interfaces

The restored SQL statements are executable and can be copied directly for testing.

JavaBackend DevelopmentMyBatisIDEA pluginsql-logging
Top Architecture Tech Stack
Written by

Top Architecture Tech Stack

Sharing Java and Python tech insights, with occasional practical development tool tips.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.