aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Malewski <maciej.malewski@nokia.com>2020-07-17 08:31:51 +0200
committerMaciej Malewski <maciej.malewski@nokia.com>2020-07-21 08:35:51 +0200
commitd8f4b453be2dd8b188ad4bca11cede52a30e7806 (patch)
tree4740721a0ca7f82e880068121f678a6fa87af8d3
parent08eb98801d6c009a2819ea913105e1fcabf0c08a (diff)
Upgrade log4j to 2.13.1 and add log4j api 2.13.1.
Issue-ID: OPTFRA-752 Signed-off-by: Maciej Malewski <maciej.malewski@nokia.com> Change-Id: Ib39de5e892f00c07c812a8dc8d3ac7d1fca009cf
-rw-r--r--cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java4
-rw-r--r--cmso-database/src/test/java/org/onap/optf/cmso/liquibase/LiquibaseApplicationTests.java4
-rw-r--r--cmso-logger/pom.xml57
-rw-r--r--cmso-logger/src/main/java/org/onap/logger/Logger.java123
-rw-r--r--cmso-logger/src/main/java/org/onap/observations/ObservationInterface.java (renamed from cmso-service/src/main/java/org/onap/observations/ObservationInterface.java)29
-rw-r--r--cmso-optimizer/pom.xml40
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java4
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/exceptions/CmsoException.java2
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Mdc.java13
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Observation.java77
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationInterface.java49
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationObject.java3
-rw-r--r--cmso-service/pom.xml42
-rw-r--r--cmso-service/src/main/java/org/onap/observations/Observation.java75
-rw-r--r--cmso-service/src/main/java/org/onap/observations/ObservationObject.java3
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/common/DomainsEnum.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/common/LogMessages.java2
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/DispatchedOptimizerList.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmApprovalStatusEnum.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmAsset.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmChangeInfo.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmStatusEnum.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfChangeManagementResponse.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfCmResponse200.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoRequestReferences.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoResponse.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfVidCmResponse.java4
-rw-r--r--cmso-ticketmgt/pom.xml40
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java65
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java53
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java3
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java2
-rw-r--r--cmso-topology/pom.xml40
-rw-r--r--cmso-topology/src/main/java/org/onap/observations/Observation.java69
-rw-r--r--cmso-topology/src/main/java/org/onap/observations/ObservationInterface.java49
-rw-r--r--cmso-topology/src/main/java/org/onap/observations/ObservationObject.java2
-rw-r--r--cmso-topology/src/main/java/org/onap/optf/cmso/topology/common/LogMessages.java2
-rw-r--r--pom.xml5
38 files changed, 326 insertions, 575 deletions
diff --git a/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java
index e3a581d..d8b67bf 100644
--- a/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java
+++ b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-database/src/test/java/org/onap/optf/cmso/liquibase/LiquibaseApplicationTests.java b/cmso-database/src/test/java/org/onap/optf/cmso/liquibase/LiquibaseApplicationTests.java
index f63701e..2c646d8 100644
--- a/cmso-database/src/test/java/org/onap/optf/cmso/liquibase/LiquibaseApplicationTests.java
+++ b/cmso-database/src/test/java/org/onap/optf/cmso/liquibase/LiquibaseApplicationTests.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-logger/pom.xml b/cmso-logger/pom.xml
new file mode 100644
index 0000000..2665690
--- /dev/null
+++ b/cmso-logger/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>cmso</artifactId>
+ <groupId>org.onap.optf.cmso</groupId>
+ <version>2.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>cmso-logger</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>${eelf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ </exclusion>
+
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>${javax.version.rs.api}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/cmso-logger/src/main/java/org/onap/logger/Logger.java b/cmso-logger/src/main/java/org/onap/logger/Logger.java
new file mode 100644
index 0000000..602def3
--- /dev/null
+++ b/cmso-logger/src/main/java/org/onap/logger/Logger.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2019 AT&T Intellectual Property.
+ * Modified 2020 Nokia.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.logger;
+
+import com.att.eelf.configuration.EELFLogger;
+import org.apache.logging.log4j.spi.StandardLevel;
+import org.onap.observations.ObservationInterface;
+
+public class Logger {
+
+ private final EELFLogger log;
+ private final EELFLogger metrics;
+ private final EELFLogger audit;
+ private final EELFLogger errors;
+ private final EELFLogger debug;
+
+ public Logger(EELFLogger log, EELFLogger metrics, EELFLogger audit, EELFLogger errors, EELFLogger debug) {
+ this.log = log;
+ this.metrics = metrics;
+ this.audit = audit;
+ this.errors = errors;
+ this.debug = debug;
+ }
+
+ public void report(ObservationInterface obs, Exception except, String... arguments) {
+
+ if (obs.getAudit()) {
+ audit.info(obs, except, arguments);
+ }
+ if (obs.getMetric()) {
+ metrics.info(obs, except, arguments);
+ }
+
+ final StandardLevel standardLevel = obs.getLevel().getStandardLevel();
+
+ switch (standardLevel) {
+ case WARN:
+ errors.warn(obs, arguments);
+ debug.debug(obs, except, arguments);
+ break;
+ case INFO:
+ log.info(obs, except, arguments);
+ debug.debug(obs, except, arguments);
+ break;
+ case ERROR:
+ errors.error(obs, arguments);
+ debug.debug(obs, except, arguments);
+ break;
+ case TRACE:
+ debug.trace(obs, except, arguments);
+ break;
+ case DEBUG:
+ debug.debug(obs, except, arguments);
+ break;
+ default:
+ log.info(obs, except, arguments);
+ }
+
+ }
+
+ public void report(ObservationInterface obs, String... arguments) {
+
+ if (obs.getAudit()) {
+ audit.info(obs, arguments);
+ }
+ if (obs.getMetric()) {
+ metrics.info(obs, arguments);
+ }
+
+ final StandardLevel standardLevel = obs.getLevel().getStandardLevel();
+
+ switch (standardLevel) {
+ case WARN:
+ errors.warn(obs, arguments);
+ debug.debug(obs, arguments);
+ break;
+ case INFO:
+ log.info(obs, arguments);
+ debug.debug(obs, arguments);
+ break;
+ case ERROR:
+ errors.error(obs, arguments);
+ debug.debug(obs, arguments);
+ break;
+ case TRACE:
+ debug.debug(obs, arguments);
+ break;
+ case DEBUG:
+ debug.debug(obs, arguments);
+ break;
+ default:
+ log.info(obs, arguments);
+ }
+ }
+}
diff --git a/cmso-service/src/main/java/org/onap/observations/ObservationInterface.java b/cmso-logger/src/main/java/org/onap/observations/ObservationInterface.java
index 0dce93d..bc14f33 100644
--- a/cmso-service/src/main/java/org/onap/observations/ObservationInterface.java
+++ b/cmso-logger/src/main/java/org/onap/observations/ObservationInterface.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 AT&T Intellectual Property.
+ * Modified 2020 Nokia.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@@ -26,24 +27,20 @@
package org.onap.observations;
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
-
-public interface ObservationInterface extends EELFResolvableErrorEnum {
- public Enum<?> getValue();
-
- public Level getLevel();
- public String getMessage();
-
- public Status getStatus();
-
- public String getDomain();
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+import org.apache.logging.log4j.Level;
- public String name();
+import static javax.ws.rs.core.Response.Status;
- public Boolean getAudit();
+public interface ObservationInterface extends EELFResolvableErrorEnum {
- public Boolean getMetric();
+ Enum<?> getValue();
+ Level getLevel();
+ String getMessage();
+ Status getStatus();
+ String getDomain();
+ String name();
+ Boolean getAudit();
+ Boolean getMetric();
}
diff --git a/cmso-optimizer/pom.xml b/cmso-optimizer/pom.xml
index bf6e3eb..a899f87 100644
--- a/cmso-optimizer/pom.xml
+++ b/cmso-optimizer/pom.xml
@@ -159,30 +159,6 @@
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </exclusion>
-
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
@@ -190,11 +166,6 @@
<!-- <dependency> <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-aaf</artifactId>
<version>2.1.1</version> </dependency> -->
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.1</version>
- </dependency>
<!--Swagger Dependencies -->
<dependency>
@@ -250,6 +221,17 @@
<groupId>org.onap.aaf.authz</groupId>
<artifactId>aaf-cadi-aaf</artifactId>
<version>${aaf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.optf.cmso</groupId>
+ <artifactId>cmso-logger</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java
index e6aa29e..faba1df 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java
@@ -34,8 +34,8 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
-import org.onap.optf.cmso.optimizer.observations.ObservationInterface;
+import org.apache.logging.log4j.Level;
+import org.onap.observations.ObservationInterface;
/**
* The Enum LogMessages.
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/exceptions/CmsoException.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/exceptions/CmsoException.java
index f780390..d2d1cc7 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/exceptions/CmsoException.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/exceptions/CmsoException.java
@@ -30,8 +30,8 @@ import com.att.eelf.i18n.EELFResourceManager;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response.Status;
+import org.onap.observations.ObservationInterface;
import org.onap.optf.cmso.optimizer.common.CmsoRequestError;
-import org.onap.optf.cmso.optimizer.observations.ObservationInterface;
/**
* The Class CMSException.
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Mdc.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Mdc.java
index 66834fa..e994d18 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Mdc.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Mdc.java
@@ -38,10 +38,9 @@ import static com.att.eelf.configuration.Configuration.MDC_TARGET_ENTITY;
import static com.att.eelf.configuration.Configuration.MDC_TARGET_SERVICE_NAME;
import com.att.eelf.utils.Stopwatch;
-import java.net.URI;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
+import org.onap.observations.ObservationInterface;
+import org.onap.optf.cmso.optimizer.observations.MessageHeaders.HeadersEnum;
+import org.slf4j.MDC;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientResponseContext;
@@ -49,8 +48,10 @@ import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response.StatusType;
-import org.onap.optf.cmso.optimizer.observations.MessageHeaders.HeadersEnum;
-import org.slf4j.MDC;
+import java.net.URI;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
/**
* EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY)
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Observation.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Observation.java
index cb36e40..baedf3a 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Observation.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/Observation.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 AT&T Intellectual Property.
+ * Modified 2020 Nokia.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@@ -28,10 +29,10 @@ package org.onap.optf.cmso.optimizer.observations;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Level;
+import org.onap.logger.Logger;
+import org.onap.observations.ObservationInterface;
import org.onap.optf.cmso.optimizer.Application;
-
/**
* The Class Observation.
*/
@@ -42,88 +43,36 @@ public class Observation {
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+ private static Logger logger = new Logger(log, metrics, audit, errors, debug);
+
+
/**
* Report.
*
- * @param obs the o
- * @param execpt the e
+ * @param obs the o
+ * @param except the e
* @param arguments the arguments
*/
// *************************************************************************************************
- public static void report(ObservationInterface obs, Exception execpt, String... arguments) {
+ public static void report(ObservationInterface obs, Exception except, String... arguments) {
Mdc.setCaller(4);
Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, execpt, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, execpt, arguments);
- }
- Level lev = obs.getLevel();
- switch (lev.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, execpt, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.TRACE_INT:
- debug.trace(obs, execpt, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, execpt, arguments);
- break;
- default:
- log.info(obs, execpt, arguments);
- }
+ logger.report(obs, except, arguments);
Mdc.clearCaller();
}
/**
* Report.
*
- * @param obs the o
+ * @param obs the o
* @param arguments the arguments
*/
public static void report(ObservationInterface obs, String... arguments) {
Mdc.setCaller(4);
Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, arguments);
- }
- Level levl = obs.getLevel();
- switch (levl.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.TRACE_INT:
- debug.debug(obs, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, arguments);
- break;
- default:
- log.info(obs, arguments);
- }
+ logger.report(obs, arguments);
Mdc.clearCaller();
}
+
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationInterface.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationInterface.java
deleted file mode 100644
index 2b4ff58..0000000
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationInterface.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2019 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed under the Creative
- * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.optf.cmso.optimizer.observations;
-
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
-
-public interface ObservationInterface extends EELFResolvableErrorEnum {
- public Enum<?> getValue();
-
- public Level getLevel();
-
- public String getMessage();
-
- public Status getStatus();
-
- public String getDomain();
-
- public String name();
-
- public Boolean getAudit();
-
- public Boolean getMetric();
-}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationObject.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationObject.java
index 60ba2a1..7d8ee69 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationObject.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/observations/ObservationObject.java
@@ -28,8 +28,9 @@ package org.onap.optf.cmso.optimizer.observations;
import com.att.eelf.i18n.EELFResolvableErrorEnum;
import com.att.eelf.i18n.EELFResourceManager;
+import org.apache.logging.log4j.Level;
+import org.onap.observations.ObservationInterface;
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
/**
diff --git a/cmso-service/pom.xml b/cmso-service/pom.xml
index db8d37e..947a995 100644
--- a/cmso-service/pom.xml
+++ b/cmso-service/pom.xml
@@ -169,41 +169,12 @@
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </exclusion>
-
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
</dependency>
<!-- <dependency> <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-aaf</artifactId>
<version>2.1.1</version> </dependency> -->
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.1</version>
- </dependency>
<!--Swagger Dependencies -->
<dependency>
@@ -263,8 +234,19 @@
<groupId>org.onap.aaf.authz</groupId>
<artifactId>aaf-cadi-aaf</artifactId>
<version>${aaf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.onap.optf.cmso</groupId>
+ <artifactId>cmso-logger</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
<build>
<finalName>cmso-service</finalName>
diff --git a/cmso-service/src/main/java/org/onap/observations/Observation.java b/cmso-service/src/main/java/org/onap/observations/Observation.java
index 3d2d176..a097345 100644
--- a/cmso-service/src/main/java/org/onap/observations/Observation.java
+++ b/cmso-service/src/main/java/org/onap/observations/Observation.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 AT&T Intellectual Property.
+ * Modified 2020 Nokia.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@@ -28,7 +29,7 @@ package org.onap.observations;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Level;
+import org.onap.logger.Logger;
import org.onap.optf.cmso.Application;
@@ -42,47 +43,21 @@ public class Observation {
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+ private static Logger logger = new Logger(log, metrics, audit, errors, debug);
+
/**
* Report.
*
* @param obs the o
- * @param execpt the e
+ * @param except the e
* @param arguments the arguments
*/
// *************************************************************************************************
- public static void report(ObservationInterface obs, Exception execpt, String... arguments) {
- Mdc.setCaller(4);
- Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, execpt, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, execpt, arguments);
- }
- Level lev = obs.getLevel();
- switch (lev.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, execpt, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.TRACE_INT:
- debug.trace(obs, execpt, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, execpt, arguments);
- break;
- default:
- log.info(obs, execpt, arguments);
- }
- Mdc.clearCaller();
+ public static void report(ObservationInterface obs, Exception except, String... arguments) {
+ Mdc.setCaller(4);
+ Mdc.setObservation(obs);
+ logger.report(obs, except, arguments);
+ Mdc.clearCaller();
}
/**
@@ -94,35 +69,7 @@ public class Observation {
public static void report(ObservationInterface obs, String... arguments) {
Mdc.setCaller(4);
Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, arguments);
- }
- Level levl = obs.getLevel();
- switch (levl.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.TRACE_INT:
- debug.debug(obs, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, arguments);
- break;
- default:
- log.info(obs, arguments);
- }
+ logger.report(obs, arguments);
Mdc.clearCaller();
}
diff --git a/cmso-service/src/main/java/org/onap/observations/ObservationObject.java b/cmso-service/src/main/java/org/onap/observations/ObservationObject.java
index f1c1277..9ed1d84 100644
--- a/cmso-service/src/main/java/org/onap/observations/ObservationObject.java
+++ b/cmso-service/src/main/java/org/onap/observations/ObservationObject.java
@@ -28,8 +28,9 @@ package org.onap.observations;
import com.att.eelf.i18n.EELFResolvableErrorEnum;
import com.att.eelf.i18n.EELFResourceManager;
+import org.apache.logging.log4j.Level;
+
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
/**
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/DomainsEnum.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/DomainsEnum.java
index cd6af4c..63e2b4a 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/common/DomainsEnum.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/DomainsEnum.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/LogMessages.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/LogMessages.java
index 3fd6cc8..6b6b544 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/common/LogMessages.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/LogMessages.java
@@ -32,7 +32,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.Level;
import org.onap.observations.ObservationInterface;
/**
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/DispatchedOptimizerList.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/DispatchedOptimizerList.java
index 871e831..c834614 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/DispatchedOptimizerList.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/DispatchedOptimizerList.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmApprovalStatusEnum.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmApprovalStatusEnum.java
index 9b004f9..7ae9df9 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmApprovalStatusEnum.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmApprovalStatusEnum.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmAsset.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmAsset.java
index ac2d9b8..0802ec1 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmAsset.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmAsset.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmChangeInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmChangeInfo.java
index 03b031a..d6231e0 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmChangeInfo.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmChangeInfo.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmStatusEnum.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmStatusEnum.java
index dd480b0..0bbcc92 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmStatusEnum.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/TmStatusEnum.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfChangeManagementResponse.java b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfChangeManagementResponse.java
index cdf47f5..e2266b5 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfChangeManagementResponse.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfChangeManagementResponse.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfCmResponse200.java b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfCmResponse200.java
index 65f2bcc..72b082f 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfCmResponse200.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfCmResponse200.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoRequestReferences.java b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoRequestReferences.java
index 56743c3..334cc93 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoRequestReferences.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoRequestReferences.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoResponse.java b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoResponse.java
index 1876c93..c565390 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoResponse.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfMsoResponse.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfVidCmResponse.java b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfVidCmResponse.java
index 395d99d..542c898 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfVidCmResponse.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/wf/bean/WfVidCmResponse.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cmso-ticketmgt/pom.xml b/cmso-ticketmgt/pom.xml
index 7ba9a83..6c68abb 100644
--- a/cmso-ticketmgt/pom.xml
+++ b/cmso-ticketmgt/pom.xml
@@ -159,37 +159,8 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </exclusion>
-
- </exclusions>
- </dependency>
<!-- <dependency> <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-aaf</artifactId>
<version>2.1.1</version> </dependency> -->
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.1</version>
- </dependency>
<!--Swagger Dependencies -->
<dependency>
@@ -249,6 +220,17 @@
<groupId>org.onap.aaf.authz</groupId>
<artifactId>aaf-cadi-aaf</artifactId>
<version>${aaf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.optf.cmso</groupId>
+ <artifactId>cmso-logger</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
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 8d053bf..23226ab 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 AT&T Intellectual Property.
+ * Modified 2020 Nokia.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +33,7 @@ package org.onap.observations;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Level;
+import org.onap.logger.Logger;
public class Observation {
@@ -42,6 +43,8 @@ public class Observation {
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+ private static Logger logger = new Logger(log, metrics, audit, errors, debug);
+
/**
* Report.
*
@@ -53,35 +56,7 @@ public class Observation {
public static void report(ObservationInterface obs, Exception exc, String... arguments) {
Mdc.setCaller(4);
Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, exc, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, exc, arguments);
- }
- Level lev = obs.getLevel();
- switch (lev.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, exc, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, exc, arguments);
- debug.debug(obs, exc, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, exc, arguments);
- break;
- case Level.TRACE_INT:
- debug.trace(obs, exc, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, exc, arguments);
- break;
- default:
- log.info(obs, exc, arguments);
- }
+ logger.report(obs, exc, arguments);
Mdc.clearCaller();
}
@@ -94,35 +69,7 @@ public class Observation {
public static void report(ObservationInterface obs, String... arguments) {
Mdc.setCaller(4);
Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, arguments);
- }
- Level lev = obs.getLevel();
- switch (lev.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.TRACE_INT:
- debug.debug(obs, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, arguments);
- break;
- default:
- log.info(obs, arguments);
- }
+ logger.report(obs, arguments);
Mdc.clearCaller();
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
deleted file mode 100644
index ebe657a..0000000
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2019 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.observations;
-
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
-
-public interface ObservationInterface extends EELFResolvableErrorEnum {
- public Enum<?> getValue();
-
- public Level getLevel();
-
- public String getMessage();
-
- public Status getStatus();
-
- public String getDomain();
-
- public String name();
-
- public Boolean getAudit();
-
- public Boolean getMetric();
-}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
index 8544047..3069dbe 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
@@ -32,8 +32,9 @@ package org.onap.observations;
import com.att.eelf.i18n.EELFResolvableErrorEnum;
import com.att.eelf.i18n.EELFResourceManager;
+import org.apache.logging.log4j.Level;
+
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
public class ObservationObject implements ObservationInterface {
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java
index 584c140..1f394a3 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java
@@ -38,7 +38,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.Level;
import org.onap.observations.ObservationInterface;
public enum LogMessages implements ObservationInterface {
diff --git a/cmso-topology/pom.xml b/cmso-topology/pom.xml
index 756d75b..deb6ecf 100644
--- a/cmso-topology/pom.xml
+++ b/cmso-topology/pom.xml
@@ -148,41 +148,12 @@
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </exclusion>
-
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
</dependency>
<!-- <dependency> <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-aaf</artifactId>
<version>2.1.1</version> </dependency> -->
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.1</version>
- </dependency>
<!--Swagger Dependencies -->
<dependency>
@@ -237,6 +208,17 @@
<groupId>org.onap.aaf.authz</groupId>
<artifactId>aaf-cadi-aaf</artifactId>
<version>${aaf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.optf.cmso</groupId>
+ <artifactId>cmso-logger</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
diff --git a/cmso-topology/src/main/java/org/onap/observations/Observation.java b/cmso-topology/src/main/java/org/onap/observations/Observation.java
index e1ec30c..fdb8b51 100644
--- a/cmso-topology/src/main/java/org/onap/observations/Observation.java
+++ b/cmso-topology/src/main/java/org/onap/observations/Observation.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 AT&T Intellectual Property.
+ * Modified 2020 Nokia.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@@ -28,7 +29,7 @@ package org.onap.observations;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Level;
+import org.onap.logger.Logger;
import org.onap.optf.cmso.topology.Application;
@@ -42,46 +43,20 @@ public class Observation {
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+ private static Logger logger = new Logger(log, metrics, audit, errors, debug);
+
/**
* Report.
*
* @param obs the o
- * @param execpt the e
+ * @param except the e
* @param arguments the arguments
*/
// *************************************************************************************************
- public static void report(ObservationInterface obs, Exception execpt, String... arguments) {
+ public static void report(ObservationInterface obs, Exception except, String... arguments) {
Mdc.setCaller(4);
Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, execpt, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, execpt, arguments);
- }
- Level lev = obs.getLevel();
- switch (lev.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, execpt, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, execpt, arguments);
- break;
- case Level.TRACE_INT:
- debug.trace(obs, execpt, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, execpt, arguments);
- break;
- default:
- log.info(obs, execpt, arguments);
- }
+ logger.report(obs, except, arguments);
Mdc.clearCaller();
}
@@ -94,35 +69,7 @@ public class Observation {
public static void report(ObservationInterface obs, String... arguments) {
Mdc.setCaller(4);
Mdc.setObservation(obs);
- if (obs.getAudit()) {
- audit.info(obs, arguments);
- }
- if (obs.getMetric()) {
- metrics.info(obs, arguments);
- }
- Level levl = obs.getLevel();
- switch (levl.toInt()) {
- case Level.WARN_INT:
- errors.warn(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.INFO_INT:
- log.info(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.ERROR_INT:
- errors.error(obs, arguments);
- debug.debug(obs, arguments);
- break;
- case Level.TRACE_INT:
- debug.debug(obs, arguments);
- break;
- case Level.DEBUG_INT:
- debug.debug(obs, arguments);
- break;
- default:
- log.info(obs, arguments);
- }
+ logger.report(obs, arguments);
Mdc.clearCaller();
}
diff --git a/cmso-topology/src/main/java/org/onap/observations/ObservationInterface.java b/cmso-topology/src/main/java/org/onap/observations/ObservationInterface.java
deleted file mode 100644
index 0dce93d..0000000
--- a/cmso-topology/src/main/java/org/onap/observations/ObservationInterface.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2019 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed under the Creative
- * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.observations;
-
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
-
-public interface ObservationInterface extends EELFResolvableErrorEnum {
- public Enum<?> getValue();
-
- public Level getLevel();
-
- public String getMessage();
-
- public Status getStatus();
-
- public String getDomain();
-
- public String name();
-
- public Boolean getAudit();
-
- public Boolean getMetric();
-}
diff --git a/cmso-topology/src/main/java/org/onap/observations/ObservationObject.java b/cmso-topology/src/main/java/org/onap/observations/ObservationObject.java
index f1c1277..fa93cb3 100644
--- a/cmso-topology/src/main/java/org/onap/observations/ObservationObject.java
+++ b/cmso-topology/src/main/java/org/onap/observations/ObservationObject.java
@@ -28,8 +28,8 @@ package org.onap.observations;
import com.att.eelf.i18n.EELFResolvableErrorEnum;
import com.att.eelf.i18n.EELFResourceManager;
+import org.apache.logging.log4j.Level;
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
/**
diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/common/LogMessages.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/common/LogMessages.java
index b5f1c0e..4386435 100644
--- a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/common/LogMessages.java
+++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/common/LogMessages.java
@@ -34,7 +34,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.ws.rs.core.Response.Status;
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.Level;
import org.onap.observations.ObservationInterface;
public enum LogMessages implements ObservationInterface {
diff --git a/pom.xml b/pom.xml
index 0a723ef..1d0238c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,8 @@
<eelf.version>1.0.0</eelf.version>
<swagger.core.version>2.0.0</swagger.core.version>
<aaf.version>2.1.4</aaf.version>
+ <log4j.version>2.13.1</log4j.version>
+ <javax.version.rs.api>2.1</javax.version.rs.api>
<docker.push.registry>localhost:5000</docker.push.registry>
<docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
<docker.http_proxy></docker.http_proxy>
@@ -96,7 +98,8 @@
<module>cmso-ticketmgt</module>
<module>cmso-robot</module>
<module>cmso-sonar</module>
- </modules>
+ <module>cmso-logger</module>
+ </modules>
<build>
<pluginManagement>