2 * Copyright © 2016-2017 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.logging.context.impl;
19 import org.openecomp.sdc.logging.context.MdcData;
20 import org.openecomp.sdc.logging.types.LoggerConstants;
24 public class MdcDataErrorMessage extends MdcData {
25 private String targetEntity;
26 private String targetServiceName;
27 private String errorDescription;
30 * Instantiates a new Mdc data error message.
32 * @param targetEntity the target entity
33 * @param targetServiceName the target service name
34 * @param errorCategory the error category
35 * @param errorCode the error code
36 * @param errorDescription the error description
38 public MdcDataErrorMessage(String targetEntity, String targetServiceName, String errorCategory,
39 String errorCode, String errorDescription) {
40 super(errorCategory, errorCode);
41 this.targetEntity = targetEntity;
42 this.targetServiceName = targetServiceName;
43 this.errorDescription = errorDescription;
49 * Create error message and update mdc.
51 * @param targetEntity the target entity
52 * @param targetServiceName the target service name
53 * @param level the level
54 * @param errorCode the error code
55 * @param errorDescription the error description
57 public static void createErrorMessageAndUpdateMdc(String targetEntity, String targetServiceName,
58 String level, String errorCode,
59 String errorDescription) {
60 MdcDataErrorMessage mdcDataErrorMessage =
61 new MdcDataErrorMessage(targetEntity, targetServiceName, level, errorCode,
66 public void setMdcValues() {
68 MDC.put(LoggerConstants.TARGET_ENTITY, this.targetEntity);
69 MDC.put(LoggerConstants.TARGET_SERVICE_NAME, this.targetServiceName);
70 MDC.put(LoggerConstants.ERROR_DESCRIPTION, this.errorDescription);