简体   繁体   中英

Pretty print queries in MyBatis log

I'm using MyBatis (through Spring which I believe is not important in this case) to generate complex SQL queries from XML mapper file. All works great except when it comes to logging. The queries get logged successfully but they are totally unformatted. There are several empty lines every time I use <include /> for example and overall it's hard to get what is going on or possibly find an error.

So my question: is there a way how to nicely format the SQL query which is being logged though logger?

If you use intellij, i think you may need my plugin "Restore Sql for iBatis/MyBatis", you can install in the Browse repositorys..

The plugin introduction:
https://plugins.jetbrains.com/plugin/9229-restore-sql-for-ibatis-mybatis

If you don't use intellij, you can reference my code, and create your own plugin:
https://github.com/kookob/RestoreSql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM