aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
diff options
context:
space:
mode:
Diffstat (limited to 'cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java')
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java166
1 files changed, 78 insertions, 88 deletions
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java b/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
index 0e1b1da..83b8f8d 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
@@ -29,97 +29,87 @@
*/
package org.onap.observations;
-import org.apache.log4j.Level;
-
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
+import org.apache.log4j.Level;
+
+
+public class Observation {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(Observation.class);
+ private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
+ private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
+ private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
+ private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+ // *************************************************************************************************
+ public static void report(ObservationInterface o, Exception e, String... arguments) {
+ Mdc.setCaller(4);
+ Mdc.setObservation(o);
+ if (o.getAudit()) {
+ audit.info(o, e, arguments);
+ }
+ if (o.getMetric()) {
+ metrics.info(o, e, arguments);
+ }
+ Level l = o.getLevel();
+ switch (l.toInt()) {
+ case Level.WARN_INT:
+ errors.warn(o, arguments);
+ debug.debug(o, e, arguments);
+ break;
+ case Level.INFO_INT:
+ log.info(o, e, arguments);
+ debug.debug(o, e, arguments);
+ break;
+ case Level.ERROR_INT:
+ errors.error(o, arguments);
+ debug.debug(o, e, arguments);
+ break;
+ case Level.TRACE_INT:
+ debug.trace(o, e, arguments);
+ break;
+ case Level.DEBUG_INT:
+ debug.debug(o, e, arguments);
+ break;
+ default:
+ log.info(o, e, arguments);
+ }
+ Mdc.clearCaller();
+ }
-public class Observation
-{
- private static EELFLogger log = EELFManager.getInstance().getLogger(Observation.class);
- private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
- private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
- private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
- private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
-
- //*************************************************************************************************
- public static void report(ObservationInterface o, Exception e, String ...arguments)
- {
- Mdc.setCaller(4);
- Mdc.setObservation(o);
- if (o.getAudit())
- {
- audit.info(o, e, arguments);
- }
- if (o.getMetric())
- {
- metrics.info(o, e, arguments);
- }
- Level l = o.getLevel();
- switch (l.toInt())
- {
- case Level.WARN_INT:
- errors.warn(o, arguments);
- debug.debug(o, e, arguments);
- break;
- case Level.INFO_INT:
- log.info(o, e, arguments);
- debug.debug(o, e, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(o, arguments);
- debug.debug(o, e, arguments);
- break;
- case Level.TRACE_INT:
- debug.trace(o, e, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(o, e, arguments);
- break;
- default:
- log.info(o, e, arguments);
- }
- Mdc.clearCaller();
- }
-
- public static void report(ObservationInterface o, String ...arguments)
- {
- Mdc.setCaller(4);
- Mdc.setObservation(o);
- if (o.getAudit())
- {
- audit.info(o, arguments);
- }
- if (o.getMetric())
- {
- metrics.info(o, arguments);
- }
- Level l = o.getLevel();
- switch (l.toInt())
- {
- case Level.WARN_INT:
- errors.warn(o, arguments);
- debug.debug(o, arguments);
- break;
- case Level.INFO_INT:
- log.info(o, arguments);
- debug.debug(o, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(o, arguments);
- debug.debug(o, arguments);
- break;
- case Level.TRACE_INT:
- debug.debug(o, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(o, arguments);
- break;
- default:
- log.info(o, arguments);
- }
- Mdc.clearCaller();
- }
+ public static void report(ObservationInterface o, String... arguments) {
+ Mdc.setCaller(4);
+ Mdc.setObservation(o);
+ if (o.getAudit()) {
+ audit.info(o, arguments);
+ }
+ if (o.getMetric()) {
+ metrics.info(o, arguments);
+ }
+ Level l = o.getLevel();
+ switch (l.toInt()) {
+ case Level.WARN_INT:
+ errors.warn(o, arguments);
+ debug.debug(o, arguments);
+ break;
+ case Level.INFO_INT:
+ log.info(o, arguments);
+ debug.debug(o, arguments);
+ break;
+ case Level.ERROR_INT:
+ errors.error(o, arguments);
+ debug.debug(o, arguments);
+ break;
+ case Level.TRACE_INT:
+ debug.debug(o, arguments);
+ break;
+ case Level.DEBUG_INT:
+ debug.debug(o, arguments);
+ break;
+ default:
+ log.info(o, arguments);
+ }
+ Mdc.clearCaller();
+ }
}