What is MyBatis Log Formatting?
When MyBatis runs a query, it logs two separate lines: a Preparing line with the SQL template (using ? placeholders) and a Parameters line listing each value with its Java type. This tool merges them into a single, executable SQL statement.
How to Use This Tool
- Copy the relevant lines from your application log
- Paste the log into the left panel
- The tool automatically finds
Preparing:andParameters:lines - Each
?placeholder is replaced with the correct typed value - The resulting SQL is formatted and shown on the right
- Click Copy to copy it to your clipboard
Supported Log Formats
- Standard MyBatis
==> Preparing:/==> Parameters:format - Logger-prefixed lines (Logback, Log4j, etc.)
- Multiple SQL statements in one paste
- All common Java types: Integer, Long, String, Boolean, Double, Timestamp, Date, BigDecimal, null
Example Log Input
==> Preparing: SELECT * FROM user WHERE id = ? AND name = ? ==> Parameters: 1(Integer), Alice(String)
Becomes:
SELECT * FROM user WHERE id = 1 AND name = 'Alice'
FAQ
What is MyBatis log formatting?
MyBatis outputs SQL in two separate log lines: a Preparing line with the SQL template using ? placeholders, and a Parameters line listing each value with its Java type. This tool merges them into a single executable SQL statement.
Which Java types are supported?
Integer, Long, Short, Byte, Double, Float, BigDecimal, String, Boolean, Timestamp, Date, LocalDate, LocalDateTime, and null.
Can I paste logs from Logback or Log4j?
Yes. The tool automatically strips logger prefixes and timestamps, so you can paste raw log output from any logging framework including Logback, Log4j, and SLF4J.
Can I paste multiple SQL statements at once?
Yes. Paste as many Preparing/Parameters pairs as you like. The tool processes each pair independently and outputs all the resulting SQL statements.