mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
[Fix]滚动日志路径解析不正确
例如 rotate:test.log 路径解析不正确
This commit is contained in:
parent
b327edf521
commit
fed3bc3084
@ -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)
|
||||
if v[0:1] == "/" {
|
||||
path = fmt.Sprintf("rotate:/%%2F%s", v[1:])
|
||||
} else {
|
||||
path = fmt.Sprintf("rotate:/%s", v)
|
||||
}
|
||||
} else {
|
||||
path = v
|
||||
}
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user