diff --git a/util/logutil/slow_query_logger.go b/util/logutil/slow_query_logger.go index c64333afd9baf..cf03dd34e6b80 100644 --- a/util/logutil/slow_query_logger.go +++ b/util/logutil/slow_query_logger.go @@ -15,17 +15,15 @@ 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 // level of the global log config doesn't affect the slow query logger which determines whether to // log by execution duration. sqConfig.Level = LogConfig{}.Level 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