enhance: support trace log level for segcore (#44003)

#43230

Signed-off-by: luzhang <luzhang@zilliz.com>
Co-authored-by: luzhang <luzhang@zilliz.com>
This commit is contained in:
zhagnlu 2025-08-25 17:55:52 +08:00 committed by GitHub
parent d079947bdf
commit 1a30012014
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import (
"os/signal" "os/signal"
"path/filepath" "path/filepath"
"runtime/debug" "runtime/debug"
"strings"
"sync" "sync"
"syscall" "syscall"
"time" "time"
@ -244,7 +245,12 @@ func (mr *MilvusRoles) setupLogger() {
if !event.HasUpdated || event.EventType == config.DeleteType { if !event.HasUpdated || event.EventType == config.DeleteType {
return return
} }
logLevel, err := zapcore.ParseLevel(event.Value) v := event.Value
// trace is not a valid log level for non-segcore part, so we convert it to debug
if strings.EqualFold(v, "trace") {
v = "debug"
}
logLevel, err := zapcore.ParseLevel(v)
if err != nil { if err != nil {
log.Warn("failed to parse log level", zap.Error(err)) log.Warn("failed to parse log level", zap.Error(err))
return return

View File

@ -852,7 +852,7 @@ msgChannel:
# Configures the system log output. # Configures the system log output.
log: log:
# Milvus log level. Option: debug, info, warn, error, panic, and fatal. # Milvus log level. Option: trace, debug, info, warn, error, panic, and fatal.
# It is recommended to use debug level under test and development environments, and info level in production environment. # It is recommended to use debug level under test and development environments, and info level in production environment.
level: info level: info
file: file:

View File

@ -92,7 +92,11 @@ func InitLogger(cfg *Config, opts ...zap.Option) (*zap.Logger, *ZapProperties, e
} }
replaceLeveledLoggers(debugL) replaceLeveledLoggers(debugL)
level := zapcore.DebugLevel level := zapcore.DebugLevel
if err := level.UnmarshalText([]byte(cfg.Level)); err != nil { parsedLevel := cfg.Level
if strings.EqualFold(parsedLevel, "trace") {
parsedLevel = "debug"
}
if err := level.UnmarshalText([]byte(parsedLevel)); err != nil {
return nil, nil, err return nil, nil, err
} }
r.Level.SetLevel(level) r.Level.SetLevel(level)

View File

@ -1389,7 +1389,7 @@ func (l *logConfig) init(base *BaseTable) {
Key: "log.level", Key: "log.level",
DefaultValue: "info", DefaultValue: "info",
Version: "2.0.0", Version: "2.0.0",
Doc: `Milvus log level. Option: debug, info, warn, error, panic, and fatal. Doc: `Milvus log level. Option: trace, debug, info, warn, error, panic, and fatal.
It is recommended to use debug level under test and development environments, and info level in production environment.`, It is recommended to use debug level under test and development environments, and info level in production environment.`,
Export: true, Export: true,
} }