Log mybatis sql query

Vinodhini Chockalingam
1 min readJan 8, 2019

--

To log SQL queries from a specific mapper in mybatis, add the mapper namespace to the logger level.

Eg :

If this is the mapper file,

<mapper namespace=”customer”>

Then to log statements that are defined in this mapper xml,

<logger name=”customer”> 
<level value=”trace”/>
<appender-ref ref=”consoleAppender” />
</logger>

Reference :
http://www.mybatis.org/mybatis-3/logging.html

Originally published at cheeky-chinnu.blogspot.com on January 8, 2019.

--

--

Vinodhini Chockalingam
Vinodhini Chockalingam

Written by Vinodhini Chockalingam

Not a blogger. I mostly move my well-written notes here.

No responses yet