Skip to content

Commit

Permalink
executor: force print slow log when trace is enabled (#20569) (#20578)
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
ti-srebot authored Nov 4, 2020
1 parent 3a40109 commit 821b753
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,9 @@ func (a *ExecStmt) LogSlowQuery(txnTS uint64, succ bool, hasMoreResults bool) {
costTime := time.Since(sessVars.StartTime) + sessVars.DurationParse
threshold := time.Duration(atomic.LoadUint64(&cfg.Log.SlowThreshold)) * time.Millisecond
enable := cfg.Log.EnableSlowLog
// if the level is Debug, print slow logs anyway
if (!enable || costTime < threshold) && level > zapcore.DebugLevel {
// if the level is Debug, or trace is enabled, print slow logs anyway
force := level <= zapcore.DebugLevel || trace.IsEnabled()
if (!enable || costTime < threshold) && !force {
return
}
var sql stringutil.StringerFunc
Expand Down

0 comments on commit 821b753

Please sign in to comment.