diff options
Diffstat (limited to 'common-app-logging/src/main')
26 files changed, 213 insertions, 561 deletions
diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java new file mode 100644 index 0000000000..6862fdddc3 --- /dev/null +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.common.log.api; + +public interface ILogConfiguration { + + String MDC_SERVICE_INSTANCE_ID = "ServiceInstanceID"; + String MDC_SERVER_IP_ADDRESS = "ServerIPAddress"; + String MDC_REMOTE_HOST = "RemoteHost"; + String MDC_AUDIT_MESSAGE = "AuditMessage"; + String MDC_END_TIMESTAMP = "EndTimestamp"; + String MDC_ELAPSED_TIME = "ElapsedTime"; + String MDC_PROCESS_KEY = "ProcessKey"; + String MDC_TARGET_VIRTUAL_ENTITY = "TargetVirtualEntity"; + String MDC_ERROR_CATEGORY = "ErrorCategory"; + String MDC_ERROR_CODE = "ErrorCode"; + String MDC_ERROR_DESC = "ErrorDescription"; + String MDC_CLASS_NAME = "ClassName"; + String MDC_OPT_FIELD1 = "CustomField1"; + String MDC_OPT_FIELD2 = "CustomField2"; + String MDC_OPT_FIELD3 = "CustomField3"; + String MDC_OPT_FIELD4 = "CustomField4"; + String MDC_OUTGOING_INVOCATION_ID = "OutgoingInvocationId"; + String MDC_SUPPORTABLITY_ACTION = "SupportablityAction"; + String MDC_SUPPORTABLITY_CSAR_UUID="SupportablityCsarUUID"; + String MDC_SUPPORTABLITY_CSAR_VERSION="SupportablityCsarVersion"; + String MDC_SUPPORTABLITY_COMPONENT_NAME = "SupportablityComponentName"; + String MDC_SUPPORTABLITY_COMPONENT_UUID = "SupportablityComponentUUID"; + String MDC_SUPPORTABLITY_COMPONENT_VERSION="SupportablityComponentVersion"; + String MDC_SUPPORTABLITY_STATUS_CODE = "SupportablityStatus"; +}
\ No newline at end of file diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java index 7d1783314f..ed1a19d76d 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java @@ -1,27 +1,10 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.api; import org.openecomp.sdc.common.log.enums.Severity; +/** + * Created by dd4296 on 12/25/2017. + */ public interface ILogFieldsHandler { void startAuditTimer(); diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java index 866498cefd..9a2ad6960a 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java @@ -1,22 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ package org.openecomp.sdc.common.log.api; import org.openecomp.sdc.common.log.enums.LogLevel; @@ -24,6 +5,9 @@ import org.slf4j.Marker; import java.util.List; +/** + * Created by dd4296 on 12/24/2017. + */ public interface ILogger { void log(LogLevel logLevel, String message); void log(Marker marker, LogLevel logLevel, String message); diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/LogConfigurationConstants.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/LogConfigurationConstants.java deleted file mode 100644 index d1d5a3af7c..0000000000 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/api/LogConfigurationConstants.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.common.log.api; - -public final class LogConfigurationConstants { - - public static final String MDC_SERVICE_INSTANCE_ID = "ServiceInstanceID"; - public static final String MDC_SERVER_IP_ADDRESS = "ServerIPAddress"; - public static final String MDC_REMOTE_HOST = "RemoteHost"; - public static final String MDC_AUDIT_MESSAGE = "AuditMessage"; - public static final String MDC_END_TIMESTAMP = "EndTimestamp"; - public static final String MDC_ELAPSED_TIME = "ElapsedTime"; - public static final String MDC_PROCESS_KEY = "ProcessKey"; - public static final String MDC_TARGET_VIRTUAL_ENTITY = "TargetVirtualEntity"; - public static final String MDC_ERROR_CATEGORY = "ErrorCategory"; - public static final String MDC_ERROR_CODE = "ErrorCode"; - public static final String MDC_ERROR_DESC = "ErrorDescription"; - public static final String MDC_CLASS_NAME = "ClassName"; - public static final String MDC_OPT_FIELD1 = "CustomField1"; - public static final String MDC_OPT_FIELD2 = "CustomField2"; - public static final String MDC_OPT_FIELD3 = "CustomField3"; - public static final String MDC_OPT_FIELD4 = "CustomField4"; - public static final String MDC_OUTGOING_INVOCATION_ID = "OutgoingInvocationId"; - public static final String MDC_SUPPORTABLITY_ACTION = "SupportablityAction"; - public static final String MDC_SUPPORTABLITY_CSAR_UUID = "SupportablityCsarUUID"; - public static final String MDC_SUPPORTABLITY_CSAR_VERSION = "SupportablityCsarVersion"; - public static final String MDC_SUPPORTABLITY_COMPONENT_NAME = "SupportablityComponentName"; - public static final String MDC_SUPPORTABLITY_COMPONENT_UUID = "SupportablityComponentUUID"; - public static final String MDC_SUPPORTABLITY_COMPONENT_VERSION = "SupportablityComponentVersion"; - public static final String MDC_SUPPORTABLITY_STATUS_CODE = "SupportablityStatus"; -}
\ No newline at end of file diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/ErrorLogOptionalData.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/ErrorLogOptionalData.java index d5279b1101..fce1143ad1 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/ErrorLogOptionalData.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/ErrorLogOptionalData.java @@ -1,37 +1,28 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; public class ErrorLogOptionalData { private String targetEntity; private String targetServiceName; + public ErrorLogOptionalData() { + } + String getTargetEntity() { return targetEntity; } + private void setTargetEntity(String targetEntity) { + this.targetEntity = targetEntity; + } + String getTargetServiceName() { return targetServiceName; } + private void setTargetServiceName(String targetServiceName) { + this.targetServiceName = targetServiceName; + } + public static Builder newBuilder() { return new Builder(); } @@ -44,12 +35,12 @@ public class ErrorLogOptionalData { } public Builder targetEntity(String targetEntity) { - instance.targetEntity = targetEntity; + instance.setTargetEntity(targetEntity); return this; } public Builder targetServiceName(String targetServiceName) { - instance.targetServiceName = targetServiceName; + instance.setTargetServiceName(targetServiceName); return this; } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java index 361c255009..eb1646c612 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java @@ -1,29 +1,9 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; import org.apache.commons.lang3.StringUtils; import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.openecomp.sdc.common.log.api.LogConfigurationConstants; import org.openecomp.sdc.common.log.enums.ConstantsLogging; +import org.openecomp.sdc.common.log.api.ILogConfiguration; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; import org.openecomp.sdc.common.log.enums.Severity; import org.slf4j.Logger; @@ -37,6 +17,8 @@ import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; +import static java.lang.Integer.valueOf; + public class LogFieldsMdcHandler implements ILogFieldsHandler { private static LogFieldsMdcHandler instanceMdcWrapper = new LogFieldsMdcHandler(); @@ -50,7 +32,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { .ofPattern(dateFormatPattern); protected static Logger log = LoggerFactory.getLogger(LogFieldsMdcHandler.class.getName()); protected static String hostAddress; - private static String fqdn; + protected static String fqdn; static { try { @@ -79,7 +61,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { public void stopAuditTimer() { //set start time if it is not set yet startAuditTimer(); - MDC.put(LogConfigurationConstants.MDC_END_TIMESTAMP, generatedTimeNow()); + MDC.put(ILogConfiguration.MDC_END_TIMESTAMP, generatedTimeNow()); setElapsedTime(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); } @@ -87,13 +69,13 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { public void stopMetricTimer() { //set start time if it is not set yet startMetricTimer(); - MDC.put(LogConfigurationConstants.MDC_END_TIMESTAMP, generatedTimeNow()); + MDC.put(ILogConfiguration.MDC_END_TIMESTAMP, generatedTimeNow()); setElapsedTime(MDC.get(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP)); } @Override public void setClassName(String className) { - MDC.put(LogConfigurationConstants.MDC_CLASS_NAME, className); + MDC.put(ILogConfiguration.MDC_CLASS_NAME, className); } @Override @@ -103,7 +85,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void setServerIPAddress(String serverIPAddress) { - MDC.put(LogConfigurationConstants.MDC_SERVER_IP_ADDRESS, serverIPAddress); + MDC.put(ILogConfiguration.MDC_SERVER_IP_ADDRESS, serverIPAddress); } @Override @@ -123,7 +105,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void setProcessKey(String processKey) { - MDC.put(LogConfigurationConstants.MDC_PROCESS_KEY, processKey); + MDC.put(ILogConfiguration.MDC_PROCESS_KEY, processKey); } @Override @@ -133,12 +115,12 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void setOptCustomField1(String customField1) { - MDC.put(LogConfigurationConstants.MDC_OPT_FIELD1, customField1); + MDC.put(ILogConfiguration.MDC_OPT_FIELD1, customField1); } @Override public void setOutgoingInvocationId(String outgoingInvocationId) { - MDC.put(LogConfigurationConstants.MDC_OUTGOING_INVOCATION_ID, outgoingInvocationId); + MDC.put(ILogConfiguration.MDC_OUTGOING_INVOCATION_ID, outgoingInvocationId); } @Override @@ -155,7 +137,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void setRemoteHost(String remoteHost) { - MDC.put(LogConfigurationConstants.MDC_REMOTE_HOST, remoteHost); + MDC.put(ILogConfiguration.MDC_REMOTE_HOST, remoteHost); } @Override @@ -185,7 +167,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void setServiceInstanceId(String serviceInstanceId) { - MDC.put(LogConfigurationConstants.MDC_SERVICE_INSTANCE_ID, serviceInstanceId); + MDC.put(ILogConfiguration.MDC_SERVICE_INSTANCE_ID, serviceInstanceId); } @Override @@ -200,22 +182,22 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void setTargetVirtualEntity(String targetVirtualEntity) { - MDC.put(LogConfigurationConstants.MDC_TARGET_VIRTUAL_ENTITY, targetVirtualEntity); + MDC.put(ILogConfiguration.MDC_TARGET_VIRTUAL_ENTITY, targetVirtualEntity); } @Override public void setErrorCode(int errorCode) { - MDC.put(LogConfigurationConstants.MDC_ERROR_CODE, Integer.toString(errorCode)); + MDC.put(ILogConfiguration.MDC_ERROR_CODE, valueOf(errorCode).toString()); } @Override public void setErrorCategory(String errorCategory) { - MDC.put(LogConfigurationConstants.MDC_ERROR_CATEGORY, errorCategory); + MDC.put(ILogConfiguration.MDC_ERROR_CATEGORY, errorCategory); } @Override public String getErrorCode() { - return MDC.get(LogConfigurationConstants.MDC_ERROR_CODE); + return MDC.get(ILogConfiguration.MDC_ERROR_CODE); } @Override @@ -225,7 +207,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public String getErrorCategory() { - return MDC.get(LogConfigurationConstants.MDC_ERROR_CATEGORY); + return MDC.get(ILogConfiguration.MDC_ERROR_CATEGORY); } @Override @@ -285,7 +267,7 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void removeServiceInstanceId() { - MDC.remove(LogConfigurationConstants.MDC_SERVICE_INSTANCE_ID); + MDC.remove(ILogConfiguration.MDC_SERVICE_INSTANCE_ID); } @Override @@ -300,81 +282,87 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void removeTargetVirtualEntity() { - MDC.remove(LogConfigurationConstants.MDC_TARGET_VIRTUAL_ENTITY); + MDC.remove(ILogConfiguration.MDC_TARGET_VIRTUAL_ENTITY); } @Override public void removeErrorCode() { - MDC.remove(LogConfigurationConstants.MDC_ERROR_CODE); + MDC.remove(ILogConfiguration.MDC_ERROR_CODE); } @Override public void removeErrorCategory() { - MDC.remove(LogConfigurationConstants.MDC_ERROR_CATEGORY); + MDC.remove(ILogConfiguration.MDC_ERROR_CATEGORY); } @Override public void removeErrorDescription() { - MDC.remove(LogConfigurationConstants.MDC_ERROR_DESC); + MDC.remove(ILogConfiguration.MDC_ERROR_DESC); } @Override public void setAuditMessage(String message) { - MDC.put(LogConfigurationConstants.MDC_AUDIT_MESSAGE, message); + MDC.put(ILogConfiguration.MDC_AUDIT_MESSAGE, message); } @Override public String getAuditMessage() { - return MDC.get(LogConfigurationConstants.MDC_AUDIT_MESSAGE); + return MDC.get(ILogConfiguration.MDC_AUDIT_MESSAGE); } + @Override public String getSupportablityStatusCode() { - return MDC.get(LogConfigurationConstants.MDC_SUPPORTABLITY_STATUS_CODE); + return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_STATUS_CODE); } @Override public String getSupportablityAction() { - return MDC.get(LogConfigurationConstants.MDC_SUPPORTABLITY_ACTION); + return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_ACTION); } @Override public String getRemoteHost() { - return MDC.get(LogConfigurationConstants.MDC_REMOTE_HOST); + return MDC.get(ILogConfiguration.MDC_REMOTE_HOST); } @Override public String getServerIpAddress() { - return MDC.get(LogConfigurationConstants.MDC_SERVER_IP_ADDRESS); + return MDC.get(ILogConfiguration.MDC_SERVER_IP_ADDRESS); } +// @Override +// public String getSupportablityCsarName() { +// return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_NAME); +// } + @Override public String getSupportablityCsarUUID() { - return MDC.get(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_UUID); + return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID); } @Override public String getSupportablityCsarVersion() { - return MDC.get(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_VERSION); + return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION); } @Override public String getSupportablityComponentName() { - return MDC.get(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_NAME); + return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME); } @Override public String getSupportablityComponentUUID() { - return MDC.get(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_UUID); + return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID); } @Override public String getSupportablityComponentVersion() { - return MDC.get(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_VERSION); + return MDC.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION); } @Override @@ -384,72 +372,77 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { @Override public void setSupportablityStatusCode(String statusCode) { - MDC.put(LogConfigurationConstants.MDC_SUPPORTABLITY_STATUS_CODE, statusCode); + MDC.put(ILogConfiguration.MDC_SUPPORTABLITY_STATUS_CODE, statusCode); } @Override public void setSupportablityAction(String action) { - MDC.put(LogConfigurationConstants.MDC_SUPPORTABLITY_ACTION, action); + MDC.put(ILogConfiguration.MDC_SUPPORTABLITY_ACTION, action); } @Override public void setSupportablityCsarUUID(String uuid) { - MDC.put(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_UUID, uuid); + MDC.put(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID, uuid); } @Override public void setSupportablityCsarVersion(String version) { - MDC.put(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_VERSION, version); + MDC.put(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION, version); } @Override public void setSupportablityComponentName(String name) { - MDC.put(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_NAME, name); + MDC.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME, name); } @Override public void setSupportablityComponentUUID(String uuid) { - MDC.put(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_UUID, uuid); + MDC.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID, uuid); } @Override public void setSupportablityComponentVersion(String version) { - MDC.put(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_VERSION, version); + MDC.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION, version); } @Override public void removeSupportablityAction() { - MDC.remove(LogConfigurationConstants.MDC_SUPPORTABLITY_ACTION); + MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_ACTION); } @Override public void removeSupportablityComponentName() { - MDC.remove(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_NAME); + MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME); } @Override public void removeSupportablityComponentUUID() { - MDC.remove(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_UUID); + MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID); } @Override public void removeSupportablityComponentVersion() { - MDC.remove(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_VERSION); + MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION); } +// @Override +// public void removeSupportablityCsarName() { +// MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_NAME); +// } + @Override public void removeSupportablityCsarUUID() { - MDC.remove(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_UUID); + MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID); } @Override public void removeSupportablityCsarVersion() { - MDC.remove(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_VERSION); + MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION); } @Override public void removeSupportablityStatusCode() { - MDC.remove(LogConfigurationConstants.MDC_SUPPORTABLITY_STATUS_CODE); + MDC.remove(ILogConfiguration.MDC_SUPPORTABLITY_STATUS_CODE); } @Override @@ -461,10 +454,10 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler { try { final LocalDateTime startTime = LocalDateTime.parse(beginTimestamp, dateTimeFormatter); final LocalDateTime endTime = LocalDateTime - .parse(MDC.get(LogConfigurationConstants.MDC_END_TIMESTAMP), dateTimeFormatter); + .parse(MDC.get(ILogConfiguration.MDC_END_TIMESTAMP), dateTimeFormatter); final Duration timeDifference = Duration.between(startTime, endTime); - MDC.put(LogConfigurationConstants.MDC_ELAPSED_TIME, String.valueOf(timeDifference.toMillis())); + MDC.put(ILogConfiguration.MDC_ELAPSED_TIME, String.valueOf(timeDifference.toMillis())); } catch (Exception ex) { log.error("failed to calculate elapsed time", ex); diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java index 502b7a6871..771ecfd9d4 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java @@ -1,27 +1,8 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; + import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.openecomp.sdc.common.log.api.LogConfigurationConstants; +import org.openecomp.sdc.common.log.api.ILogConfiguration; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; import org.openecomp.sdc.common.log.enums.Severity; @@ -35,30 +16,30 @@ import java.util.Collections; import java.util.List; public class LoggerAudit extends LoggerBase { - private static List<String> mandatoryFields = new ArrayList<>(Arrays.asList( + private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, - LogConfigurationConstants.MDC_END_TIMESTAMP, + ILogConfiguration.MDC_END_TIMESTAMP, ONAPLogConstants.MDCs.REQUEST_ID, ONAPLogConstants.MDCs.SERVICE_NAME, ONAPLogConstants.MDCs.PARTNER_NAME, ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.MDCs.RESPONSE_CODE, - LogConfigurationConstants.MDC_SERVICE_INSTANCE_ID, + ILogConfiguration.MDC_SERVICE_INSTANCE_ID, ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, - LogConfigurationConstants.MDC_ELAPSED_TIME, - LogConfigurationConstants.MDC_SERVER_IP_ADDRESS, + ILogConfiguration.MDC_ELAPSED_TIME, + ILogConfiguration.MDC_SERVER_IP_ADDRESS, ONAPLogConstants.MDCs.SERVER_FQDN)); - private static List<String> optionalFields = new ArrayList<>(Arrays.asList( + private static ArrayList<String> optionalFields = new ArrayList<>(Arrays.asList( ONAPLogConstants.MDCs.INSTANCE_UUID, ONAPLogConstants.MDCs.RESPONSE_SEVERITY, - LogConfigurationConstants.MDC_REMOTE_HOST, - LogConfigurationConstants.MDC_CLASS_NAME, - LogConfigurationConstants.MDC_PROCESS_KEY, - LogConfigurationConstants.MDC_OPT_FIELD1, - LogConfigurationConstants.MDC_OPT_FIELD2, - LogConfigurationConstants.MDC_OPT_FIELD3, - LogConfigurationConstants.MDC_OPT_FIELD4)); + ILogConfiguration.MDC_REMOTE_HOST, + ILogConfiguration.MDC_CLASS_NAME, + ILogConfiguration.MDC_PROCESS_KEY, + ILogConfiguration.MDC_OPT_FIELD1, + ILogConfiguration.MDC_OPT_FIELD2, + ILogConfiguration.MDC_OPT_FIELD3, + ILogConfiguration.MDC_OPT_FIELD4)); LoggerAudit(ILogFieldsHandler ecompMdcWrapper, Logger logger) { //TODO Andrey, set default marker @@ -85,7 +66,7 @@ public class LoggerAudit extends LoggerBase { } public LoggerAudit setOptClassName(String className) { - MDC.put(LogConfigurationConstants.MDC_CLASS_NAME, className); + MDC.put(ILogConfiguration.MDC_CLASS_NAME, className); return this; } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java index 5b2bfad5b9..4ee6039d32 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; import com.google.common.annotations.VisibleForTesting; @@ -38,6 +18,12 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; + +/** + * Created by mm288v on 12/27/2017. + * This class holds the common behavior of all Loger-Typed classes. + * The Concrete loggers shoudl derive from this one. + */ public abstract class LoggerBase implements ILogger { private final Logger myLogger; private final Marker myMarker; diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java index dc8c4b4c16..cebe7bac51 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; import org.onap.logging.ref.slf4j.ONAPLogConstants; @@ -33,7 +13,7 @@ import java.util.List; public class LoggerDebug extends LoggerBase { - private static List<String> mandatoryFields = new ArrayList<>(Arrays.asList(ONAPLogConstants.MDCs.REQUEST_ID)); + private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList(ONAPLogConstants.MDCs.REQUEST_ID)); LoggerDebug(ILogFieldsHandler ecompMdcWrapper, Logger logger) { super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.DEBUG_MARKER.text()), logger); diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java index a38f16df98..fbf610638b 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java @@ -1,28 +1,8 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; import org.apache.commons.lang3.StringUtils; import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.openecomp.sdc.common.log.api.LogConfigurationConstants; +import org.openecomp.sdc.common.log.api.ILogConfiguration; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; import org.openecomp.sdc.common.log.enums.EcompErrorSeverity; import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; @@ -40,8 +20,8 @@ public class LoggerError extends LoggerBase { private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( ONAPLogConstants.MDCs.REQUEST_ID, ONAPLogConstants.MDCs.SERVICE_NAME, - LogConfigurationConstants.MDC_ERROR_CATEGORY, - LogConfigurationConstants.MDC_ERROR_CODE)); + ILogConfiguration.MDC_ERROR_CATEGORY, + ILogConfiguration.MDC_ERROR_CODE)); public static final String defaultServiceName = "SDC catalog"; diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java index 59e2777966..f2f33b2457 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; import org.slf4j.Logger; @@ -35,19 +15,19 @@ public class LoggerFactory { @SuppressWarnings("unchecked") public static <T, V> V getLogger(Class<T> type, Logger logger) { - if (type.getName().equals(LoggerAudit.class.getName())) { + if (type.isAssignableFrom(LoggerAudit.class)) { return (V) new LoggerAudit(new LogFieldsMdcHandler(), logger); } - if (type.getName().equals(LoggerDebug.class.getName())) { + if (type.isAssignableFrom(LoggerDebug.class)) { return (V) new LoggerDebug(new LogFieldsMdcHandler(), logger); } - if (type.getName().equals(LoggerMetric.class.getName())) { + if (type.isAssignableFrom(LoggerMetric.class)) { return (V) new LoggerMetric(new LogFieldsMdcHandler(), logger); } - if (type.getName().equals(LoggerError.class.getName())) { + if (type.isAssignableFrom(LoggerError.class)) { return (V) new LoggerError(new LogFieldsMdcHandler(), logger); } @@ -57,19 +37,19 @@ public class LoggerFactory { @SuppressWarnings("unchecked") public static <T, V> V getMdcLogger(Class<T> type, Logger logger) { - if (type.getName().equals(LoggerAudit.class.getName())) { + if (type.isAssignableFrom(LoggerAudit.class)) { return (V) new LoggerAudit(LogFieldsMdcHandler.getInstance(), logger); } - if (type.getName().equals(LoggerDebug.class.getName())) { + if (type.isAssignableFrom(LoggerDebug.class)) { return (V) new LoggerDebug(LogFieldsMdcHandler.getInstance(), logger); } - if (type.getName().equals(LoggerMetric.class.getName())) { + if (type.isAssignableFrom(LoggerMetric.class)) { return (V) new LoggerMetric(LogFieldsMdcHandler.getInstance(), logger); } - if (type.getName().equals(LoggerError.class.getName())) { + if (type.isAssignableFrom(LoggerError.class)) { return (V) new LoggerError(LogFieldsMdcHandler.getInstance(), logger); } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java index 3dbcf1dde3..8af85ea1a3 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; @@ -33,11 +13,11 @@ import java.util.Arrays; import java.util.List; import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.*; -import static org.openecomp.sdc.common.log.api.LogConfigurationConstants.*; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; public class LoggerMetric extends LoggerBase { - private static List<String> mandatoryFields = new ArrayList<>(Arrays.asList( + private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( INVOKE_TIMESTAMP, MDC_END_TIMESTAMP, REQUEST_ID, @@ -51,7 +31,7 @@ public class LoggerMetric extends LoggerBase { MDC_SERVER_IP_ADDRESS, SERVER_FQDN)); - private static List<String> optionalFields = new ArrayList<>(Arrays.asList( + private static ArrayList<String> optionalFields = new ArrayList<>(Arrays.asList( MDC_TARGET_VIRTUAL_ENTITY, TARGET_ENTITY, TARGET_SERVICE_NAME, diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java index 849add3625..b3b91b96be 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java @@ -1,26 +1,6 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.elements; -import org.openecomp.sdc.common.log.api.LogConfigurationConstants; +import org.openecomp.sdc.common.log.api.ILogConfiguration; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; import org.openecomp.sdc.common.log.enums.LogLevel; import org.openecomp.sdc.common.log.enums.LogMarkers; @@ -53,23 +33,23 @@ public class LoggerSupportability extends LoggerBase { log(action, null, statusCode, message, params); } - private static List<String> mandatoryFields = new ArrayList<>(Arrays.asList( - LogConfigurationConstants.MDC_SUPPORTABLITY_ACTION, - LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_UUID, - LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_VERSION, - LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_NAME, - LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_UUID, - LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_VERSION, - LogConfigurationConstants.MDC_SUPPORTABLITY_STATUS_CODE)); + private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( + ILogConfiguration.MDC_SUPPORTABLITY_ACTION, + ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID, + ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION, + ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME, + ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID, + ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION, + ILogConfiguration.MDC_SUPPORTABLITY_STATUS_CODE)); private void fillFieldsBeforeLogging(LoggerSupportabilityActions action, Map<String,String> componentMetaData,StatusCode statusCode) { clear(); if (componentMetaData!=null){ - ecompLogFieldsHandler.setSupportablityCsarUUID(componentMetaData.get(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_UUID)); - ecompLogFieldsHandler.setSupportablityCsarVersion(componentMetaData.get(LogConfigurationConstants.MDC_SUPPORTABLITY_CSAR_VERSION)); - ecompLogFieldsHandler.setSupportablityComponentName(componentMetaData.get(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_NAME)); - ecompLogFieldsHandler.setSupportablityComponentUUID(componentMetaData.get(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_UUID)); - ecompLogFieldsHandler.setSupportablityComponentVersion(componentMetaData.get(LogConfigurationConstants.MDC_SUPPORTABLITY_COMPONENT_VERSION)); + ecompLogFieldsHandler.setSupportablityCsarUUID(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID)); + ecompLogFieldsHandler.setSupportablityCsarVersion(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION)); + ecompLogFieldsHandler.setSupportablityComponentName(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME)); + ecompLogFieldsHandler.setSupportablityComponentUUID(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID)); + ecompLogFieldsHandler.setSupportablityComponentVersion(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION)); } ecompLogFieldsHandler.setSupportablityAction(action.getName()); ecompLogFieldsHandler.setSupportablityStatusCode(statusCode.getStatusCodeEnum()); diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/ConstantsLogging.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/ConstantsLogging.java index 34606dcebd..025de545a0 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/ConstantsLogging.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/ConstantsLogging.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.enums; public final class ConstantsLogging { diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompErrorSeverity.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompErrorSeverity.java index 4d21d8c8c6..e88a074f0a 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompErrorSeverity.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompErrorSeverity.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.enums; public enum EcompErrorSeverity { diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java index db174b4096..780b24d0e5 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * SDC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * 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. diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java index aaee7512bd..5b1ec9d4a9 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * SDC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * 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. @@ -17,8 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.common.log.enums; +/** + * Created by dd4296 on 12/14/2017. + */ public enum LogLevel { INFO, WARN, diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java index 7b12ded745..4f98c556e8 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java @@ -1,25 +1,9 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.enums; +/** + * Created by mm288v on 12/27/2017. + * This enum reflects the Marker text in logback.xml file per each ecomp marker + */ public enum LogMarkers { DEBUG_MARKER("DEBUG_MARKER"), ERROR_MARKER("ERROR_MARKER"), diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java index d831700dec..95594a3469 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.enums; public enum LoggerSupportabilityActions { diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java index 0e90d57c8e..15a6039f7f 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * SDC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * 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. @@ -20,6 +20,9 @@ package org.openecomp.sdc.common.log.enums; +/** + * Created by dd4296 on 12/14/2017. + */ public enum Severity { OK(0), WARNING(1), diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java index 4ed65df97b..8ede6f9d6e 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.enums; public enum StatusCode { diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java index 9c90529d22..ce33480ca2 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java @@ -1,31 +1,19 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.utils; + public enum EcompLogErrorCode { E_399("Internal Invalid Object. Description: %s"), - E_210("Connection problem towards U-EB server. Reason: %s"); + E_210( + "Connection problem towards U-EB server. Reason: %s"); String description; + String resolution; + + EcompLogErrorCode(String description, String resolution) { + this.description = description; + this.resolution = resolution; + } EcompLogErrorCode(String description) { this.description = description; @@ -39,4 +27,12 @@ public enum EcompLogErrorCode { this.description = description; } -} + public String getResolution() { + return resolution; + } + + public void setResolution(String resolution) { + this.resolution = resolution; + } + + } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/LoggingThreadLocalsHolder.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/LoggingThreadLocalsHolder.java index 3d7a16b846..c621a2a975 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/LoggingThreadLocalsHolder.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/LoggingThreadLocalsHolder.java @@ -22,9 +22,6 @@ package org.openecomp.sdc.common.log.utils; public class LoggingThreadLocalsHolder { - - private LoggingThreadLocalsHolder() { - } private static final ThreadLocal<String> uuidThreadLocal = new ThreadLocal<>(); diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java index 9c2bfec126..8f733b4f5e 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.wrappers; import com.google.common.annotations.VisibleForTesting; @@ -131,14 +111,13 @@ public class Logger implements org.slf4j.Logger { metric.log(LogLevel.INFO, msg, params); } - public void invoke(String remoteHost, String targetEntity, String targetServiceName, String serviceName, String msg, Object... params) { + public void invoke(String targetEntity, String targetServiceName, String serviceName, String msg, Object... params) { String invocationId = UUID.randomUUID().toString(); String requestID = UUID.randomUUID().toString(); metric.startTimer() .stopTimer() - .setRemoteHost(remoteHost) .setOutgoingInvocationId(invocationId) .setTargetServiceName(targetServiceName) .setTargetEntity(targetEntity) diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java index b2db66ed00..b8c1b268e1 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.wrappers; import org.apache.commons.lang3.StringUtils; diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java index cec429a000..6ca71281d3 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - package org.openecomp.sdc.common.log.wrappers; import org.apache.commons.lang3.StringUtils; @@ -31,6 +11,12 @@ import java.util.StringTokenizer; import static java.net.HttpURLConnection.*; +/** + * Created by dd4296 on 12/20/2017. + * + * base class for metric and audit log logging + * holding the specific logic for data extraction + */ public class LoggerSdcUtilBase { protected static Logger log = LoggerFactory.getLogger(LoggerSdcUtilBase.class.getName()); @@ -92,8 +78,9 @@ public class LoggerSdcUtilBase { case HTTP_BAD_METHOD: case HTTP_PROXY_AUTH: return true; - default: return false; } + + return false; } private boolean isDataError(int httpResponseCode) { @@ -106,8 +93,9 @@ public class LoggerSdcUtilBase { case HTTP_ENTITY_TOO_LARGE: case HTTP_UNSUPPORTED_TYPE: return true; - default: return false; } + + return false; } private boolean isSchemaError(int httpResponseCode) { @@ -199,6 +187,9 @@ public class LoggerSdcUtilBase { } private boolean isFound(String value) { - return (StringUtils.isNotEmpty(value)); + if (StringUtils.isNotEmpty(value)) { + return true; + } + return false; } }
\ No newline at end of file |