druid mybatis 批量打印sql语句

xvw2m8pv  于 4个月前  发布在  Druid
关注(0)|答案(3)|浏览(56)

batchupdate的时候 如何打印出全部的sql语句?设置哪个参数?

t9eec4r0

t9eec4r01#

public LoggerBackupFilter() { this.setStatementExecutableSqlLogEnable(true); this.setResultSetLogEnabled(false); this.setConnectionLogEnabled(false); this.setDataSourceLogEnabled(false); this.setStatementCreateAfterLogEnabled(false); this.setStatementPrepareAfterLogEnabled(false); this.setStatementPrepareCallAfterLogEnabled(false); this.setStatementExecuteAfterLogEnabled(false); this.setStatementExecuteQueryAfterLogEnabled(false); this.setStatementExecuteUpdateAfterLogEnabled(false); // this.setStatementExecuteBatchAfterLogEnabled(false); this.setStatementCloseAfterLogEnabled(false); this.setStatementParameterSetLogEnabled(false); this.setStatementParameterClearLogEnable(false); this.setStatementLogErrorEnabled(false); }

irtuqstp

irtuqstp2#

`
sqlMapClientTemplate.execute(new SqlMapClientCallback() {
@OverRide
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
executor.startBatch();

for (int i = 0; i < list.size(); i++) {
                    T o = list.get(i);
                    executor.update(o.getClass().getSimpleName() + POSTFIX_UPDATE_SELECTIVE, o);
                }

           
            executor.executeBatch();
            return null;
        }
    });

`

svgewumm

svgewumm3#

Mapper 包的日志级别设为 DEBUG 级别就可以了
https://www.cnblogs.com/expiator/p/8664977.html

相关问题