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;
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();
/**
* Get the MsoLogger based on the catalog
- *
+ *
* @param cat
* Catalog of the logger
* @return the MsoLogger
/**
* Record the Metrics event with no argument
- *
+ *
* @param startTime
* Transaction starting time in millieseconds
* @param statusCode
* 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("");
* 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);
* 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));
* 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));
* 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));
* 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));
* 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),
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
* 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);
* 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));
}
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");
}
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);
}
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);
/**
* Set the requestId and serviceInstanceId
- *
+ *
* @param reqId
* The requestId
* @param svcId
/**
* Set the remoteIp and the basic HTTP Authentication user
- *
+ *
* @param remoteIpp
* The remote ip address
* @param userp
/**
* Set the serviceName
- *
+ *
* @param serviceNamep
* The service name
*/
/**
* Get the serviceName
- *
+ *
* @return The service name
*/
public static String getServiceName() {
/**
* Set the requestId and serviceInstanceId based on the mso request
- *
+ *
* @param msoRequest
* The mso request
*/