-
Notifications
You must be signed in to change notification settings - Fork 8k
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
新增 csp.sentinel.log.level 启动配置项,可设置为OFF,进行关闭日志 #2514
Conversation
第一次贡献源代码,这个pr是有问题合并不了?还是需要审批流程? |
@@ -80,7 +82,9 @@ private static void startMetricTimerListener() { | |||
SentinelConfig.METRIC_FLUSH_INTERVAL); | |||
return; | |||
} | |||
SCHEDULER.scheduleAtFixedRate(new MetricTimerListener(), 0, flushInterval, TimeUnit.SECONDS); | |||
if (!LogBase.getLogLevel().equals(Level.OFF)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metric的写日志逻辑实际已经通过csp.sentinel.metric.flush.interval
参数进行控制了,这个日志打印我觉得更应该在日志层面调用去控制,而不是通过日志级别来控制metricTimerListener的启用。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,明白了,我调整一下
@@ -32,6 +32,7 @@ | |||
import java.util.concurrent.Executors; | |||
import java.util.concurrent.ScheduledExecutorService; | |||
import java.util.concurrent.TimeUnit; | |||
import java.util.logging.Level; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please remove the unused import?
// load log level | ||
String logLevelString = properties.getProperty(LOG_LEVEL); | ||
if (logLevelString != null && (logLevelString = logLevelString.trim()).length() > 0) { | ||
logLevel = Level.parse(logLevelString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the logLevel is invalid?
Could you please sign the CLA here: https://cla-assistant.io/alibaba/Sentinel?pullRequest=2514 |
cc @brotherlu-xcq Any other suggestions? |
I have no more suggestions. LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for contributing! |
* Add `csp.sentinel.log.level` property to support logging level for record logs (not for block log and metric log)
对应issues:Add record log level configuration support | 支持配置 record 日志的输出级别配置 #2505
通过添加启动配置项 csp.sentinel.log.level=OFF,可以选择性的关闭产生的日志