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

[Fix] --log-outputs relative path are not supported when --log-rotate-config-json is defined #13049

Merged
merged 2 commits into from
Jun 8, 2021
Merged
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions server/embed/config_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ func (cfg *Config) setupLogging() error {
var path string
if cfg.EnableLogRotation {
// append rotate scheme to logs managed by lumberjack log rotation
path = fmt.Sprintf("rotate:%s", v)
mumuhhh marked this conversation as resolved.
Show resolved Hide resolved
if v[0:1] == "/" {
path = fmt.Sprintf("rotate:/%%2F%s", v[1:])
} else {
path = fmt.Sprintf("rotate:/%s", v)
}
} else {
path = v
}
Expand Down Expand Up @@ -254,7 +258,7 @@ func setupLogRotation(logOutputs []string, logRotateConfigJSON string) error {
}
}
zap.RegisterSink("rotate", func(u *url.URL) (zap.Sink, error) {
logRotationConfig.Filename = u.Path
logRotationConfig.Filename = u.Path[1:]
return &logRotationConfig, nil
})
return nil
Expand Down