1 package org.openecomp.sdc.common.ecomplog;
3 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_BEGIN_TIMESTAMP;
4 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_ERROR_CATEGORY;
5 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_ERROR_CODE;
6 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_ERROR_DESC;
7 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_KEY_REQUEST_ID;
8 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_PARTNER_NAME;
9 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_SERVICE_NAME;
10 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_TARGET_ENTITY;
11 import static org.openecomp.sdc.common.ecomplog.api.IEcompLogConfiguration.MDC_TARGET_SERVICE_NAME;
13 import org.openecomp.sdc.common.ecomplog.Enums.EcompLoggerErrorCode;
14 import org.openecomp.sdc.common.ecomplog.Enums.LogMarkers;
15 import org.openecomp.sdc.common.ecomplog.api.IEcompMdcWrapper;
16 import org.slf4j.MarkerFactory;
18 public class EcompLoggerError extends EcompLoggerBase{
19 private static EcompLoggerError instanceLoggerError = EcompLoggerFactory.getLogger(EcompLoggerError.class);
21 EcompLoggerError(IEcompMdcWrapper ecompMdcWrapper) {
22 super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.ERROR_MARKER.text()));
25 public static EcompLoggerError getInstance() {
26 return instanceLoggerError;
30 public void initializeMandatoryFields() {
31 ecompMdcWrapper.setMandatoryField(MDC_BEGIN_TIMESTAMP);
32 ecompMdcWrapper.setMandatoryField(MDC_KEY_REQUEST_ID);
33 ecompMdcWrapper.setMandatoryField(MDC_SERVICE_NAME);
34 ecompMdcWrapper.setMandatoryField(MDC_PARTNER_NAME);
35 ecompMdcWrapper.setMandatoryField(MDC_ERROR_CATEGORY);
36 ecompMdcWrapper.setMandatoryField(MDC_ERROR_CODE);
37 ecompMdcWrapper.setMandatoryField(MDC_ERROR_DESC);
39 ecompMdcWrapper.setOptionalField(MDC_TARGET_ENTITY);
40 ecompMdcWrapper.setOptionalField(MDC_TARGET_SERVICE_NAME);
44 public EcompLoggerError startTimer() {
45 return (EcompLoggerError) super.startTimer();
49 public EcompLoggerError setKeyRequestId(String keyRequestId) {
50 return (EcompLoggerError) super.setKeyRequestId(keyRequestId);
53 public EcompLoggerError setServiceName(String serviceName) {
54 ecompMdcWrapper.setServiceName(serviceName);
58 public EcompLoggerError setTargetEntity(String targetEntity) {
59 ecompMdcWrapper.setTargetEntity(targetEntity);
63 public EcompLoggerError setErrorCode(EcompLoggerErrorCode errorCode) {
64 ecompMdcWrapper.setErrorCode(errorCode.getErrorCode());
68 public EcompLoggerError setErrorDescription(String errorDescription) {
69 ecompMdcWrapper.setErrorDescription(errorDescription);
73 public EcompLoggerError clear() {
74 return (EcompLoggerError) super.clear();