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"
"path/filepath"
"runtime/debug"
"strings"
"sync"
"syscall"
"time"
@ -244,7 +245,12 @@ func (mr *MilvusRoles) setupLogger() {
if !event.HasUpdated || event.EventType == config.DeleteType {
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 {
log.Warn("failed to parse log level", zap.Error(err))
return

View File

@ -852,7 +852,7 @@ msgChannel:
# Configures the system log output.
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.
level: info
file:

View File

@ -92,7 +92,11 @@ func InitLogger(cfg *Config, opts ...zap.Option) (*zap.Logger, *ZapProperties, e
}
replaceLeveledLoggers(debugL)
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
}
r.Level.SetLevel(level)

View File

@ -1389,7 +1389,7 @@ func (l *logConfig) init(base *BaseTable) {
Key: "log.level",
DefaultValue: "info",
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.`,
Export: true,
}