2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.logging.aspects;
23 import org.aspectj.lang.JoinPoint;
24 import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
25 import org.slf4j.Marker;
26 import org.slf4j.MarkerFactory;
28 import java.lang.reflect.Method;
32 * Created by TALIO on 12/26/2016.
34 public class DebugAspect {
36 private static final String MESSAGE_TEMPLATE = "'{}' '{}' with '{}'";
37 private static final Marker DEBUG = MarkerFactory.getMarker("DEBUG");
38 private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
41 // private ParameterNameDiscoverer parameterNameDiscoverer;
43 public void debugEnterMethod(final JoinPoint joinPoint){
45 Class type = joinPoint.getSignature().getDeclaringType();
46 Method currentMethod = null;
47 for(Method method : type.getMethods()){
48 if(method.getName().equals(joinPoint.getSignature().getName())){
49 currentMethod = method;
54 // String[] parameterNames = parameterNameDiscoverer.getParameterNames(currentMethod);
55 // Object[] args = joinPoint.getArgs();
56 // Parameter[] parameters = currentMethod.getParameters();
57 // StringBuilder str = new StringBuilder(joinPoint.getSignature().getName() + " with parameters:" +
59 // if(args.length == parameters.length) {
60 // for (int i = 0; i < args.length; i++) {
61 // str.append(parameters[i].getName()).append('=').append(args[i]);
64 mdcDataDebugMessage.debugEntryMessage(null, null);
67 public void debugExitMethod(final JoinPoint joinPoint){
68 mdcDataDebugMessage.debugExitMessage(null, null);