2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
24 package org.onap.clamp.flow.log;
26 import com.att.eelf.configuration.EELFLogger;
27 import com.att.eelf.configuration.EELFManager;
29 import javax.servlet.http.HttpServletRequest;
31 import org.apache.camel.Exchange;
32 import org.onap.clamp.clds.util.LoggingUtils;
33 import org.onap.clamp.clds.util.OnapLogConstants;
34 import org.slf4j.event.Level;
35 import org.springframework.beans.factory.annotation.Autowired;
36 import org.springframework.http.HttpStatus;
37 import org.springframework.stereotype.Component;
40 * The Flow log operations.
43 public class FlowLogOperation {
45 protected static final EELFLogger logger = EELFManager.getInstance().getLogger(FlowLogOperation.class);
46 protected static final EELFLogger auditLogger = EELFManager.getInstance().getMetricsLogger();
47 private LoggingUtils util = new LoggingUtils(logger);
50 private HttpServletRequest request;
53 * Generate the entry log.
56 * The service description the loop name
58 public void startLog(Exchange exchange, String serviceDesc) {
59 util.entering(request, serviceDesc);
60 exchange.setProperty(OnapLogConstants.Headers.REQUEST_ID, util.getProperties(OnapLogConstants.Mdcs.REQUEST_ID));
61 exchange.setProperty(OnapLogConstants.Headers.INVOCATION_ID,
62 util.getProperties(OnapLogConstants.Mdcs.INVOCATION_ID));
63 exchange.setProperty(OnapLogConstants.Headers.PARTNER_NAME,
64 util.getProperties(OnapLogConstants.Mdcs.PARTNER_NAME));
68 * Generate the exiting log.
70 public void endLog() {
71 util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, OnapLogConstants.ResponseStatus.COMPLETED);
75 * Generate the error exiting log.
77 public void errorLog() {
78 util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "Failed", Level.INFO,
79 OnapLogConstants.ResponseStatus.ERROR);
83 * Generate the error exiting log.
85 public void httpErrorLog() {
90 * Generate the invoke log.
92 public void invokeLog(String targetEntity, String targetServiceName) {
93 util.invoke(targetEntity, targetServiceName);
97 * Generate the invoke return marker.
99 public void invokeReturnLog() {