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

Support to config log rotate in kubeedge #27

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions pkg/common/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func InitializeLogger() {
LogFormatText: true,
Writers: []string{"stdout"},
}

rotateConfig := &rotate.RotateConfig{}
filename := strings.TrimSuffix(GetConfigDir(), "/") + LOGCONFIGPATH

//fmt.Println("logging.yaml's path is " + filename)
Expand All @@ -47,6 +47,10 @@ func InitializeLogger() {
if err != nil {
fmt.Printf("Got error when reading yaml config file:%v\n", err)
}
err = yaml.Unmarshal(content, rotateConfig)
if err != nil {
fmt.Printf("Got error when reading yaml config file:%v\n", err)
}
} else {
if os.IsNotExist(err) {
fmt.Printf("No config file exists, using default configurations for logger\n")
Expand All @@ -63,7 +67,7 @@ func InitializeLogger() {
writers := logConfig.Writers
for _, value := range writers {
if value == "file" {
rotate.RunLogRotate(logConfig.LoggerFile, &rotate.RotateConfig{}, LOGGER)
rotate.RunLogRotate(logConfig.LoggerFile, rotateConfig, LOGGER)
break
}
}
Expand Down