MyBatis Log Formatter

Paste MyBatis debug logs — the tool extracts the Preparing SQL and merges in the Parameters, then formats the result.

Home/Tools/MyBatis Log Formatter
MyBatis Log
Formatted SQL

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

  1. Copy the relevant lines from your application log
  2. Paste the log into the left panel
  3. The tool automatically finds Preparing: and Parameters: lines
  4. Each ? placeholder is replaced with the correct typed value
  5. The resulting SQL is formatted and shown on the right
  6. 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.