Skip to content

Commit

Permalink
cherry pick pingcap#27625 to release-5.2
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <[email protected]>
  • Loading branch information
SabaPing authored and ti-srebot committed Nov 18, 2021
1 parent feb4b14 commit ce9ead4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions util/logutil/slow_query_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ var _pool = buffer.NewPool()

func newSlowQueryLogger(cfg *LogConfig) (*zap.Logger, *log.ZapProperties, error) {

// copy global config and override slow query log file
// if slow query log filename is empty, slow query log will behave the same as global log
// copy the global log config to slow log config
// if the filename of slow log config is empty, slow log will behave the same as global log.
sqConfig := cfg.Config
if len(cfg.SlowQueryFile) != 0 {
sqConfig.File = log.FileLogConfig{
MaxSize: cfg.File.MaxSize,
Filename: cfg.SlowQueryFile,
}
sqConfig.File = cfg.File
sqConfig.File.Filename = cfg.SlowQueryFile
}

// create the slow query logger
Expand Down

0 comments on commit ce9ead4

Please sign in to comment.