Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logutil: force level of slow logger to "debug" #28688

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion util/logutil/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestSlowQueryLoggerCreation(t *testing.T) {
// assert after init slow query logger, the original conf is not changed
require.Equal(t, conf.Level, level)
require.Nil(t, err)
require.Equal(t, prop.Level.String(), conf.Level)
require.Equal(t, prop.Level.String(), zap.DebugLevel.String())
}

func TestGlobalLoggerReplace(t *testing.T) {
Expand Down
4 changes: 4 additions & 0 deletions util/logutil/slow_query_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func newSlowQueryLogger(cfg *LogConfig) (*zap.Logger, *log.ZapProperties, error)
// 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
// enable/disable of slow logger is controlled by different configs, not the level of global logger
// the level of slow logger should always be "debug"
sqConfig.Level = zap.DebugLevel.String()
crazycs520 marked this conversation as resolved.
Show resolved Hide resolved
// file config
if len(cfg.SlowQueryFile) != 0 {
sqConfig.File = cfg.File
sqConfig.File.Filename = cfg.SlowQueryFile
Expand Down