This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new 983ebd9 FELIX-6499 : Add option to monitor service to always log with
info level
983ebd9 is described below
commit 983ebd960c5181d8860f3219f9cd0cd9c49b9c3d
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Jan 10 07:24:30 2022 +0100
FELIX-6499 : Add option to monitor service to always log with info level
---
.../apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git
a/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java
b/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java
index 2a730a5..5e335e3 100644
---
a/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java
+++
b/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java
@@ -108,6 +108,9 @@ public class HealthCheckMonitor implements Runnable {
@AttributeDefinition(name = "Log results", description = "What updates
should be logged to regular log file (none, status changes, status changes and
not ok results, all updates)")
ChangeType logResults() default ChangeType.NONE;
+ @AttributeDefinition(name = "Log all results as INFO", description =
"If logResults is enabled and this is enabled, all results will be logged with
INFO log level. Otherwise WARN and INFO are used depending on the health
state.")
+ boolean logAllResultsAsInfo() default false;
+
@AttributeDefinition(name = "Resolve Tags (dynamic)", description =
"In dynamic mode tags are resolved to a list of health checks that are
monitored individually (this means events are sent/services are registered for
name only, never for given tags). This mode allows to use '*' in tags to query
for all health checks in system. It is also possible to query for all except
certain tags by using '-', e.g. by configuring the values '*', '-tag1' and
'-tag2' for tags.")
boolean isDynamic() default false;
@@ -147,12 +150,14 @@ public class HealthCheckMonitor implements Runnable {
private ChangeType sendEvents;
private ChangeType logResults;
+ private boolean logAllResultsAsInfo;
+
private BundleContext bundleContext;
private String monitorId;
private boolean isDynamic;
- private ServiceListener healthCheckServiceListener = null;
+ private ServiceListener healthCheckServiceListener;
@Activate
protected final void activate(BundleContext bundleContext, Config config,
ComponentContext componentContext) throws InvalidSyntaxException {
@@ -170,6 +175,7 @@ public class HealthCheckMonitor implements Runnable {
this.treatWarnAsHealthy = config.treatWarnAsHealthy();
this.sendEvents = config.sendEvents();
this.logResults = config.logResults();
+ this.logAllResultsAsInfo = config.logAllResultsAsInfo();
this.intervalInSec = config.intervalInSec();
this.cronExpression = config.cronExpression();
@@ -311,7 +317,7 @@ public class HealthCheckMonitor implements Runnable {
}
void logResultItem(boolean isOk, String msg) {
- if(isOk) {
+ if(isOk || this.logAllResultsAsInfo) {
LOG.info(msg);
} else {
LOG.warn(msg);