From 722bc342839141661feb9f695bd20babfd42b4bc Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Mon, 18 Feb 2019 13:06:40 +0800 Subject: [PATCH] add current DB name to general log (#9332) --- session/session.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/session/session.go b/session/session.go index 230f17a434a94..9747920f33054 100644 --- a/session/session.go +++ b/session/session.go @@ -1484,7 +1484,8 @@ func logStmt(node ast.StmtNode, vars *variable.SessionVars) { func logQuery(query string, vars *variable.SessionVars) { if atomic.LoadUint32(&variable.ProcessGeneralLog) != 0 && !vars.InRestrictedSQL { query = executor.QueryReplacer.Replace(query) - log.Infof("[GENERAL_LOG] con:%d user:%s schema_ver:%d txn_start_ts:%d sql:%s%s", - vars.ConnectionID, vars.User, vars.TxnCtx.SchemaVersion, vars.TxnCtx.StartTS, query, vars.GetExecuteArgumentsInfo()) + log.Infof("[GENERAL_LOG] con:%d user:%s schema_ver:%d txn_start_ts:%d current_db:%s, sql:%s%s", + vars.ConnectionID, vars.User, vars.TxnCtx.SchemaVersion, vars.TxnCtx.StartTS, vars.CurrentDB, query, + vars.GetExecuteArgumentsInfo()) } }