aboutsummaryrefslogtreecommitdiffstats
path: root/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
diff options
context:
space:
mode:
authorDaniel Cruz <dc443y@att.com>2019-02-22 11:31:17 -0600
committerDaniel Cruz <dc443y@att.com>2019-03-01 18:44:07 -0600
commit62e4281c0b76ecfde85d094533edd6693c2c1c5b (patch)
tree2baa4f571756c90cbbf806afa53d7ff17865935a /policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
parent5ac447f758d9b7a7baaf0e24a0e8621a15b8c5ff (diff)
Add Controller Logging Feature
This features provides a mechanism to extend the logback.xml properties to add controller specific loggers. The controller's logger will log messages from topics that the controller listens to in a controller specific network log. The original network log is preserved and still logs every message from every controller. Note that the way a logger is associated with a controller is by having the logger name match the controller's name. Any configuration file that has "logback-include-" prepended and a ".xml" extension will be added to the logback.xml and logback-eelf.xml files as extensions to the base configuration. Issue-ID: POLICY-1427 Change-Id: Iaeb823421eadb7ee413b6b03ae3dfe862f230612 Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java')
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java37
1 files changed, 31 insertions, 6 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
index 959114a2..740a119b 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
@@ -695,7 +695,7 @@ class PolicyEngineManager implements PolicyEngine {
throw new IllegalArgumentException(controllerName + " is invalid");
}
- logger.warn("controller being recovered. {} Reset controller's bad maven coordinates to brainless",
+ logger.warn("controller being recovered. {} Reset controller's bad maven coordinates to brainless",
controllerName);
/*
@@ -918,7 +918,7 @@ class PolicyEngineManager implements PolicyEngine {
logger.error("{}: cannot start http-server {} because of {}", this, httpServer, e.getMessage(), e);
}
}
-
+
// stop JMX?
/* policy-engine dispatch pre stop hook */
@@ -1003,7 +1003,7 @@ class PolicyEngineManager implements PolicyEngine {
exitThread.interrupt();
logger.info("{}: normal termination", this);
}
-
+
/**
* Thread that shuts down http servers.
*/
@@ -1038,13 +1038,13 @@ class PolicyEngineManager implements PolicyEngine {
doExit(0);
}
}
-
+
// these may be overridden by junit tests
protected void doSleep(long sleepMs) throws InterruptedException {
Thread.sleep(sleepMs);
}
-
+
protected void doExit(int code) {
System.exit(code);
}
@@ -1245,13 +1245,38 @@ class PolicyEngineManager implements PolicyEngine {
@Override
public void onTopicEvent(CommInfrastructure commType, String topic, String event) {
+ /* policy-engine pre topic event hook */
+ for (final PolicyEngineFeatureAPI feature : getFeatureProviders()) {
+ try {
+ if (feature.beforeOnTopicEvent(this, commType, topic, event)) {
+ return;
+ }
+ } catch (final Exception e) {
+ logger.error("{}: feature {} beforeOnTopicEvent failure on event {} because of {}", this,
+ feature.getClass().getName(), event, e.getMessage(), e);
+ }
+ }
+
/* configuration request */
+ PdpdConfiguration configuration = null;
try {
- final PdpdConfiguration configuration = this.decoder.fromJson(event, PdpdConfiguration.class);
+ configuration = this.decoder.fromJson(event, PdpdConfiguration.class);
this.configure(configuration);
} catch (final Exception e) {
logger.error("{}: configuration-error due to {} because of {}", this, event, e.getMessage(), e);
}
+
+ /* policy-engine after topic event hook */
+ for (final PolicyEngineFeatureAPI feature : getFeatureProviders()) {
+ try {
+ if (feature.afterOnTopicEvent(this, configuration, commType, topic, event)) {
+ return;
+ }
+ } catch (final Exception e) {
+ logger.error("{}: feature {} afterOnTopicEvent failure on event {} because of {}", this,
+ feature.getClass().getName(), event, e.getMessage(), e);
+ }
+ }
}
@Override