executor: add default database to query log (#5078)
This commit is contained in:
committed by
tiancaiamao
parent
a13d24cff5
commit
cedc35ca8c
@ -289,10 +289,12 @@ func (a *ExecStmt) logSlowQuery(succ bool) {
|
||||
sql = fmt.Sprintf("%.*q(len:%d)", cfg.Log.QueryLogMaxLen, sql, len(a.Text))
|
||||
}
|
||||
connID := a.ctx.GetSessionVars().ConnectionID
|
||||
currentDB := a.ctx.GetSessionVars().CurrentDB
|
||||
logEntry := log.NewEntry(logutil.SlowQueryLogger)
|
||||
logEntry.Data = log.Fields{
|
||||
"connectionId": connID,
|
||||
"costTime": costTime,
|
||||
"database": currentDB,
|
||||
"sql": sql,
|
||||
}
|
||||
if costTime < time.Duration(cfg.Log.SlowThreshold)*time.Millisecond {
|
||||
|
||||
Reference in New Issue
Block a user