diff options
Diffstat (limited to 'common/src/main/java/org/openecomp/mso/logger')
3 files changed, 51 insertions, 45 deletions
diff --git a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java b/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java index 521aa50435..ee0e294f84 100644 --- a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java +++ b/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java @@ -167,7 +167,6 @@ public enum MessageEnum implements EELFResolvableErrorEnum{ BPMN_GENERAL_METRICS,
BPMN_URN_MAPPING_FAIL,
BPMN_VARIABLE_NULL,
- BPMN_SDNC_CALLBACK_EXCEPTION,
BPMN_CALLBACK_EXCEPTION,
// ASDC Messages
ASDC_GENERAL_EXCEPTION_ARG,
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java index e9b6fb1225..a0fc765e44 100644 --- a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java +++ b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java @@ -106,7 +106,7 @@ public class MsoLogger { public enum ResponseCode { Suc(0), PermissionError(100), DataError(300), DataNotFound(301), BadRequest(302), SchemaError( 400), BusinessProcesssError(500), ServiceNotAvailable(501), InternalError( - 502), Conflict(503), DBAccessError(504), CommunicationError(505), UnknownError(900); + 502), Conflict(503), DBAccessError(504), CommunicationError(505), UnknownError(900); private int value; @@ -144,8 +144,8 @@ public class MsoLogger { private static final Logger LOGGER = Logger.getLogger(MsoLogger.class.getName()); private MsoLogger(MsoLogger.Catalog cat) { - this.debugLogger = EELFManager.getInstance().getDebugLogger(); - this.errorLogger = EELFManager.getInstance().getErrorLogger(); + this.debugLogger = EELFManager.getInstance().getDebugLogger(); + this.errorLogger = EELFManager.getInstance().getErrorLogger(); this.auditLogger = EELFManager.getInstance().getAuditLogger(); this.metricsLogger = EELFManager.getInstance().getMetricsLogger(); MsoLogger.initialization(); @@ -172,7 +172,7 @@ public class MsoLogger { /** * Get the MsoLogger based on the catalog - * + * * @param cat * Catalog of the logger * @return the MsoLogger @@ -183,7 +183,7 @@ public class MsoLogger { /** * Record the Metrics event with no argument - * + * * @param startTime * Transaction starting time in millieseconds * @param statusCode @@ -200,7 +200,7 @@ public class MsoLogger { * Target VNF or VM acted opon by the component, if available */ public void recordMetricEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc, - String targetEntity, String targetServiceName, String targetVEntity) { + String targetEntity, String targetServiceName, String targetVEntity) { prepareMetricMsg(startTime, statusCode, responseCode.getValue(), responseDesc, targetEntity, targetServiceName, targetVEntity); metricsLogger.info(""); @@ -222,7 +222,7 @@ public class MsoLogger { * Human redable description of the application response code */ public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, - String responseDesc) { + String responseDesc) { prepareAuditMsg(startTime, statusCode, responseCode.getValue(), responseDesc); auditLogger.info(""); MDC.remove(TIMER); @@ -293,7 +293,7 @@ public class MsoLogger { * The arguments used in the log message */ public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName) { + String targetServiceName) { prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); debugLogger.info(msg, normalize(arg0), normalize(arg1)); @@ -310,7 +310,7 @@ public class MsoLogger { * The arguments used in the log message */ public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName) { + String targetServiceName) { prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2)); @@ -327,7 +327,7 @@ public class MsoLogger { * The arguments used in the log message */ public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName) { + String targetEntity, String targetServiceName) { prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); @@ -344,7 +344,7 @@ public class MsoLogger { * The arguments used in the log message */ public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName) { + String targetEntity, String targetServiceName) { prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); @@ -361,7 +361,7 @@ public class MsoLogger { * The arguments used in the log message */ public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String arg5, String targetEntity, String targetServiceName) { + String arg5, String targetEntity, String targetServiceName) { prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4), @@ -378,7 +378,7 @@ public class MsoLogger { * The log message to put */ public void warn(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc) { + String errorDesc) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg); @@ -395,7 +395,7 @@ public class MsoLogger { * The exception info */ public void warn(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc, Throwable t) { + String errorDesc, Throwable t) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg); errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t)); @@ -413,7 +413,7 @@ public class MsoLogger { * The argument used in the log message */ public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc) { + ErrorCode errorCode, String errorDesc) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, arg); MDC.remove(TARGETENTITY); @@ -431,7 +431,7 @@ public class MsoLogger { * The exception info */ public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc, Throwable t) { + ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, arg); errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t)); @@ -449,7 +449,7 @@ public class MsoLogger { * The arguments used in the log message */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1)); MDC.remove(TARGETENTITY); @@ -467,7 +467,7 @@ public class MsoLogger { * The exception info */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1)); errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t)); @@ -485,7 +485,7 @@ public class MsoLogger { * The arguments used in the log message */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2)); MDC.remove(TARGETENTITY); @@ -503,7 +503,7 @@ public class MsoLogger { * The exception info */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2)); errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t)); @@ -521,7 +521,7 @@ public class MsoLogger { * The arguments used in the log message */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); MDC.remove(TARGETENTITY); @@ -539,7 +539,7 @@ public class MsoLogger { * The exception info */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t)); @@ -557,7 +557,7 @@ public class MsoLogger { * The arguments used in the log message */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); MDC.remove(TARGETENTITY); @@ -575,7 +575,7 @@ public class MsoLogger { * The exception info */ public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t)); @@ -592,7 +592,7 @@ public class MsoLogger { * The log message to put */ public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc) { + String errorDesc) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg); MDC.remove(TARGETENTITY); @@ -608,7 +608,7 @@ public class MsoLogger { * The exception info */ public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc, Throwable t) { + String errorDesc, Throwable t) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg); errorLogger.error(exceptionArg, getNormalizedStackTrace(t)); @@ -626,7 +626,7 @@ public class MsoLogger { * The arguments used in the log message */ public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc) { + ErrorCode errorCode, String errorDesc) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0)); MDC.remove(TARGETENTITY); @@ -644,7 +644,7 @@ public class MsoLogger { * The exception info */ public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc, Throwable t) { + ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0)); errorLogger.error(exceptionArg, getNormalizedStackTrace(t)); @@ -662,7 +662,7 @@ public class MsoLogger { * The arguments used in the log message */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1)); MDC.remove(TARGETENTITY); @@ -680,7 +680,7 @@ public class MsoLogger { * The exception info */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1)); errorLogger.error(exceptionArg, getNormalizedStackTrace(t)); @@ -698,7 +698,7 @@ public class MsoLogger { * The arguments used in the log message */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2)); MDC.remove(TARGETENTITY); @@ -716,7 +716,7 @@ public class MsoLogger { * The exception info */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2)); errorLogger.error(exceptionArg, getNormalizedStackTrace(t)); @@ -734,7 +734,7 @@ public class MsoLogger { * The arguments used in the log message */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); MDC.remove(TARGETENTITY); @@ -752,7 +752,7 @@ public class MsoLogger { * The exception info */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); errorLogger.error(exceptionArg, getNormalizedStackTrace(t)); @@ -770,7 +770,7 @@ public class MsoLogger { * The arguments used in the log message */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); MDC.remove(TARGETENTITY); @@ -788,7 +788,7 @@ public class MsoLogger { * The exception info */ public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { + String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); errorLogger.error(exceptionArg, getNormalizedStackTrace(t)); @@ -839,7 +839,7 @@ public class MsoLogger { } private void prepareAuditMetricMsg(long startTime, long endTime, StatusCode statusCode, int responseCode, - String responseDesc) { + String responseDesc) { Date startDate = new Date(startTime); Date endDate = new Date(endTime); DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); @@ -852,7 +852,7 @@ public class MsoLogger { } private void prepareErrorMsg(String loggingLevel, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc) { + ErrorCode errorCode, String errorDesc) { MDC.put(ALERT_SEVERITY, getSeverityLevel(loggingLevel)); MDC.put(ERRORCODE, String.valueOf(errorCode)); MDC.put(ERRORDESC, errorDesc); @@ -862,7 +862,7 @@ public class MsoLogger { } private void prepareMetricMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc, - String targetEntity, String targetServiceName, String targetVEntity) { + String targetEntity, String targetServiceName, String targetVEntity) { long endTime = System.currentTimeMillis(); prepareMsg(INFO_LEVEL, null, String.valueOf(endTime - startTime)); prepareAuditMetricMsg(startTime, endTime, statusCode, responseCode, responseDesc); @@ -1000,7 +1000,7 @@ public class MsoLogger { /** * Set the requestId and serviceInstanceId - * + * * @param reqId * The requestId * @param svcId @@ -1018,7 +1018,7 @@ public class MsoLogger { /** * Set the remoteIp and the basic HTTP Authentication user - * + * * @param remoteIpp * The remote ip address * @param userp @@ -1035,7 +1035,7 @@ public class MsoLogger { /** * Set the serviceName - * + * * @param serviceNamep * The service name */ @@ -1048,7 +1048,7 @@ public class MsoLogger { /** * Get the serviceName - * + * * @return The service name */ public static String getServiceName() { @@ -1064,7 +1064,7 @@ public class MsoLogger { /** * Set the requestId and serviceInstanceId based on the mso request - * + * * @param msoRequest * The mso request */ diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java b/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java index 568ab22447..c1de64b390 100644 --- a/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java +++ b/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java @@ -39,7 +39,11 @@ import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.core.Appender; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + @Path("/logging") +@Api(value="/logging",description="logging") public class MsoLoggingServlet { private static final String DEBUGLOG = "asyncEELFDebug"; @@ -51,6 +55,7 @@ public class MsoLoggingServlet { @GET @Path("/setLevel/{logContext}/{level}") @Produces("text/plain") + @ApiOperation(value="message print",response=Response.class) public Response setLogLevel (@PathParam("logContext") String logContext, @PathParam("level") String level) { logger.info (MessageEnum.LOGGER_SETUP, "", ""); @@ -81,6 +86,7 @@ public class MsoLoggingServlet { @Path("/loggers") @Produces("text/plain") @SuppressWarnings("rawtypes") + @ApiOperation(value="message print",response=Response.class) public Response getLoggers () { StringBuilder response = new StringBuilder (); LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); @@ -99,6 +105,7 @@ public class MsoLoggingServlet { @GET @Path("/debug") @Produces("text/plain") + @ApiOperation(value="message print",response=Response.class) @SuppressWarnings("rawtypes") /* * Debug log is used as a general log to store all the logs events, including events generated by MSO code or by |