-
Notifications
You must be signed in to change notification settings - Fork 32
Setup logging after reading the config file #856
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
base: main
Are you sure you want to change the base?
Changes from all commits
5dcd9c7
5d4a10a
3051600
95d51e9
5ade0f8
6dcca59
6bb4da9
a04a2a0
bf65ecd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,7 @@ func (lm *LoggerManager) watchCfg(ctx context.Context, cfgch <-chan *config.Conf | |
| zap.NamedError("cfg marshal error", merr), | ||
| ) | ||
| } | ||
| lm.logger.Info("current config", zap.Any("cfg", acfg)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test fails because the logger outputs another thing each time the config is updated.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest you to modify the log level in the test to skip this log. Remember to add a comment to explain this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this: diff --git a/pkg/manager/logger/manager_test.go b/pkg/manager/logger/manager_test.go
index 36d4d3f..9562476 100644
--- a/pkg/manager/logger/manager_test.go
+++ b/pkg/manager/logger/manager_test.go
@@ -27,7 +27,7 @@ func TestUpdateCfg(t *testing.T) {
Log: config.Log{
Encoder: "tidb",
LogOnline: config.LogOnline{
- Level: "info",
+ Level: "error",
LogFile: config.LogFile{
Filename: fileName,
MaxSize: 1,And this: diff --git a/pkg/manager/logger/manager_test.go b/pkg/manager/logger/manager_test.go
index 36d4d3f..54216d6 100644
--- a/pkg/manager/logger/manager_test.go
+++ b/pkg/manager/logger/manager_test.go
@@ -60,6 +60,7 @@ func TestUpdateCfg(t *testing.T) {
},
{
updateCfg: func(cfg *config.LogOnline) {
+ cfg.Level = "error"
cfg.LogFile.MaxSize = 3
cfg.LogFile.MaxBackups = 5
},But neither of these seems to work.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commenting out the line like this also doesn't work: diff --git a/pkg/manager/logger/manager.go b/pkg/manager/logger/manager.go
index 97f200c..76c7e76 100644
--- a/pkg/manager/logger/manager.go
+++ b/pkg/manager/logger/manager.go
@@ -77,7 +77,7 @@ func (lm *LoggerManager) watchCfg(ctx context.Context, cfgch <-chan *config.Conf
zap.NamedError("cfg marshal error", merr),
)
}
- lm.logger.Info("current config", zap.Any("cfg", acfg))
+ // lm.logger.Info("current config", zap.Any("cfg", acfg))
}
}
}
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird. I tried and both worked. |
||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.