From 2b498abbab860e21083cab5a2456ea6710d9f39c Mon Sep 17 00:00:00 2001 From: niejiangang Date: Fri, 16 Sep 2022 17:00:13 +0800 Subject: [PATCH 1/3] fix: correct the configuration at the log level Signed-off-by: niejiangang --- collector/pkg/observability/logger/logger.go | 4 ++-- .../pkg/observability/logger/logger_test.go | 22 ------------------- 2 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 collector/pkg/observability/logger/logger_test.go diff --git a/collector/pkg/observability/logger/logger.go b/collector/pkg/observability/logger/logger.go index bf1263888..a6ad192fe 100644 --- a/collector/pkg/observability/logger/logger.go +++ b/collector/pkg/observability/logger/logger.go @@ -53,8 +53,8 @@ func InitLogger(config Config) *zap.Logger { logger.Sugar().Infof("Log Initialize Success! ConsoleLevel: %s,FileRotationLevel: %s", consoleLogLevel.String(), "none") return logger } else { - // By default, the console at the Info level is used to record logs - consoleLogLevel = zapcore.InfoLevel + // Both none, only record the panic log to console + consoleLogLevel = zapcore.DPanicLevel logger := CreateConsoleLogger() logger.Sugar().Infof("Log Initialize Success! ConsoleLevel: %s,FileRotationLevel: %s", consoleLogLevel.String(), "none") return logger diff --git a/collector/pkg/observability/logger/logger_test.go b/collector/pkg/observability/logger/logger_test.go deleted file mode 100644 index 3b6fafabc..000000000 --- a/collector/pkg/observability/logger/logger_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package logger - -import ( - "testing" - - "go.uber.org/zap" - "gopkg.in/natefinch/lumberjack.v2" -) - -func Test_newLogger(t *testing.T) { - config := &lumberjack.Logger{ - Filename: "tmp.log", - MaxSize: 500, // megabytes - MaxBackups: 3, - MaxAge: 28, - LocalTime: true, - Compress: false, - } - logger := CreateCombineLogger(config) - logger.Info("This is a Info test", zap.String("param1", "value1")) - logger.Debug("This is a Info test", zap.String("param1", "value1")) -} From 98082872a70614bb05a17b89888de3da877f9716 Mon Sep 17 00:00:00 2001 From: niejiangang Date: Fri, 16 Sep 2022 17:42:13 +0800 Subject: [PATCH 2/3] doc: update ChangeLog Signed-off-by: niejiangang --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6640c2180..a8f3b6737 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ - Allow the collector run in the non-Kubernetes environment by setting the option `enable` `false` under the `k8smetadataprocessor` section. ([#285](https://github.com/CloudDectective-Harmonycloud/kindling/pull/285)) - Add a new environment variable: IS_PRINT_EVENT. When the value is true, sinsp events can be printed to the stdout. ([#283](https://github.com/CloudDectective-Harmonycloud/kindling/pull/283)) - Declare the 9500 port in the agent's deployment file ([#282](https://github.com/CloudDectective-Harmonycloud/kindling/pull/282)) -### Bug fixes +### Bug fixes +- Avoid print log to console when both `observability.logger.file_level` and `observability.logger.console_level` are set to none([#316](https://github.com/CloudDectective-Harmonycloud/kindling/pull/316)) - Fix the userAttributes array out of range error caused by userAttNumber exceeding 8 - Fix the bug where no HTTP headers were got. ([#301](https://github.com/CloudDectective-Harmonycloud/kindling/pull/301)) - Fix the bug that need_trace_as_span options cannot take effect ([#292](https://github.com/CloudDectective-Harmonycloud/kindling/pull/292)) From 04215301b983009125e3480c6e871806624b5a62 Mon Sep 17 00:00:00 2001 From: niejiangang Date: Mon, 19 Sep 2022 11:22:39 +0800 Subject: [PATCH 3/3] doc: fix typo Signed-off-by: niejiangang --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8f3b6737..3125f82d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ - Add a new environment variable: IS_PRINT_EVENT. When the value is true, sinsp events can be printed to the stdout. ([#283](https://github.com/CloudDectective-Harmonycloud/kindling/pull/283)) - Declare the 9500 port in the agent's deployment file ([#282](https://github.com/CloudDectective-Harmonycloud/kindling/pull/282)) ### Bug fixes -- Avoid print log to console when both `observability.logger.file_level` and `observability.logger.console_level` are set to none([#316](https://github.com/CloudDectective-Harmonycloud/kindling/pull/316)) +- Avoid printing logs to console when both `observability.logger.file_level` and `observability.logger.console_level` are set to none([#316](https://github.com/CloudDectective-Harmonycloud/kindling/pull/316)) - Fix the userAttributes array out of range error caused by userAttNumber exceeding 8 - Fix the bug where no HTTP headers were got. ([#301](https://github.com/CloudDectective-Harmonycloud/kindling/pull/301)) - Fix the bug that need_trace_as_span options cannot take effect ([#292](https://github.com/CloudDectective-Harmonycloud/kindling/pull/292))