summaryrefslogtreecommitdiffstats
path: root/eelf-logging/src/main/java/org/openecomp/cl/eelf
diff options
context:
space:
mode:
authorArul.Nambi <arul.nambi@amdocs.com>2017-09-14 15:30:00 -0400
committerArul.Nambi <arul.nambi@amdocs.com>2017-09-14 15:30:51 -0400
commit2d211f3e1943ded3a0ab59553b12bee602079398 (patch)
treecbc3fc4ba4a463b94d4532b8641199d8bcf9e79f /eelf-logging/src/main/java/org/openecomp/cl/eelf
parentc8ed19f31ae454dab4cd9ce59886a3578b24f58b (diff)
Renaming openecomp to onap
Issue-ID: AAI-208 Change-Id: I11d428593971c665f0ebdf56465d87161ef7d112 Signed-off-by: Arul.Nambi <arul.nambi@amdocs.com>
Diffstat (limited to 'eelf-logging/src/main/java/org/openecomp/cl/eelf')
-rw-r--r--eelf-logging/src/main/java/org/openecomp/cl/eelf/AaiLoggerAdapter.java351
-rw-r--r--eelf-logging/src/main/java/org/openecomp/cl/eelf/AuditLogLine.java83
-rw-r--r--eelf-logging/src/main/java/org/openecomp/cl/eelf/ErrorLogLine.java44
-rw-r--r--eelf-logging/src/main/java/org/openecomp/cl/eelf/LogMessageEnum.java33
-rw-r--r--eelf-logging/src/main/java/org/openecomp/cl/eelf/LoggerFactory.java179
-rw-r--r--eelf-logging/src/main/java/org/openecomp/cl/eelf/MetricsLogLine.java85
6 files changed, 0 insertions, 775 deletions
diff --git a/eelf-logging/src/main/java/org/openecomp/cl/eelf/AaiLoggerAdapter.java b/eelf-logging/src/main/java/org/openecomp/cl/eelf/AaiLoggerAdapter.java
deleted file mode 100644
index 28bf1aa..0000000
--- a/eelf-logging/src/main/java/org/openecomp/cl/eelf/AaiLoggerAdapter.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.cl.eelf;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFLogger.Level;
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import com.att.eelf.i18n.EELFResourceManager;
-
-import org.openecomp.cl.api.LogFields;
-import org.openecomp.cl.api.LogLine;
-import org.openecomp.cl.api.LogLine.LogLineType;
-import org.openecomp.cl.api.Logger;
-import org.openecomp.cl.mdc.MdcOverride;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This class provides a logging implementation which wraps the EELF logging
- * framework.
- */
-public class AaiLoggerAdapter implements Logger {
-
- public static final String BAD_ENUM_MSG = "UNRECOGNIZABLE ERROR CODE ";
-
- /** Field name to use for the message portion of our log lines. */
- public static final String MESSAGE_PREFIX = "Msg";
-
- /**
- * A place holder to use for fields in the standardized log message that we
- * are not explicitly setting.
- */
- public static final String NOT_APPLICABLE = "na";
-
- /**
- * The instance of the actual EELF logger that we will be sending our messages
- * to.
- */
- private EELFLogger eelfLogger;
-
- /**
- * This indicates the logging format type. It is used for deciding the string
- * builder for constructing standardized log statements.
- */
- private LogLineType logLineType;
-
- /** An identifier for the component that is generating the log statements. */
- private String component = NOT_APPLICABLE;
-
- /**
- * Creates a new instance of the {@link AaiLoggerAdapter}, backed by the
- * supplied {@link EELFLogger} instance.
- *
- * @param eelfLogger
- * - The instance of {@link EELFLogger} that this logger will invoke.
- */
- public AaiLoggerAdapter(EELFLogger eelfLogger, LogLineType logLineType, String componentName) {
-
- // Store the supplied EELFLogger instance.
- this.eelfLogger = eelfLogger;
- this.logLineType = logLineType;
- this.component = componentName;
- }
-
- @Override
- public boolean isTraceEnabled() {
- return eelfLogger.isTraceEnabled();
- }
-
- @Override
- public boolean isInfoEnabled() {
- return eelfLogger.isInfoEnabled();
- }
-
- @Override
- public boolean isErrorEnabled() {
- return eelfLogger.isErrorEnabled();
- }
-
- @Override
- public boolean isWarnEnabled() {
- return eelfLogger.isWarnEnabled();
- }
-
- @Override
- public boolean isDebugEnabled() {
- return eelfLogger.isDebugEnabled();
- }
-
- /**
- * Sets a number of the common fields which prefix all standard log
- * statements.
- */
- private void initLogLine(LogLine logLine, String level, String logCode, String msg,
- LogFields fields) {
- logLine.init(component, logCode, level, msg, fields, new MdcOverride());
- }
-
- private void initLogLine(LogLine logLine, String level, String logCode, String msg,
- LogFields fields, MdcOverride override) {
- logLine.init(component, logCode, level, msg, fields, override);
- }
-
- @Override
- public void info(Enum logCode, String... arguments) {
- info(logCode, new LogFields(), arguments);
- }
-
- @Override
- public void info(Enum logCode, LogFields fields, String... arguments) {
-
- // We expect our error code to be compatible with the templating
- // functionality provided by the EELF framework, so make sure
- // that this is the case before we try to decode our error code.
- if (logCode instanceof LogMessageEnum) {
- // Cast our error code enum to make the EELF framework happy.
- LogMessageEnum eelfLogCode = (LogMessageEnum) logCode;
-
- // Initialize the log line
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.INFO.toString(), EELFResourceManager.getIdentifier(eelfLogCode),
- EELFResourceManager.format(eelfLogCode, arguments),
- (fields == null) ? new LogFields() : fields);
-
- // Pass our log string to the EELF logging framework.
- eelfLogger.info(logLine.getFormattedLine());
- } else {
- eelfLogger.error(BAD_ENUM_MSG + logCode.toString());
- }
- }
-
- @Override
- public void info(Enum logCode, LogFields fields, MdcOverride override, String... arguments) {
-
- // We expect our error code to be compatible with the templating
- // functionality provided by the EELF framework, so make sure
- // that this is the case before we try to decode our error code.
- if (logCode instanceof LogMessageEnum) {
- // Cast our error code enum to make the EELF framework happy.
- LogMessageEnum eelfLogCode = (LogMessageEnum) logCode;
-
- // Initialize the log line
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.INFO.toString(), EELFResourceManager.getIdentifier(eelfLogCode),
- EELFResourceManager.format(eelfLogCode, arguments),
- (fields == null) ? new LogFields() : fields, override);
-
- // Pass our log string to the EELF logging framework.
- eelfLogger.info(logLine.getFormattedLine());
- } else {
- eelfLogger.error(BAD_ENUM_MSG + logCode.toString());
- }
- }
-
- @Override
- public void debug(String message) {
- // Initialize the log line
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.DEBUG.toString(), "", message, new LogFields());
-
- // Pass our log string the the EELF logging framework.
- eelfLogger.debug(logLine.getFormattedLine());
- }
-
- @Override
- public void debug(Enum logCode, String... arguments) {
- debug(logCode, new LogFields(), arguments);
- }
-
- @Override
- public void debug(Enum logCode, LogFields fields, String... arguments) {
-
- // We expect our log code to be compatible with the templating
- // functionality provided by the EELF framework, so make sure
- // that this is the case before we try to decode it.
- if (logCode instanceof LogMessageEnum) {
- // Cast our error code enum to make the EELF framework happy.
- LogMessageEnum eelfLogCode = (LogMessageEnum) logCode;
-
- // Initialize the log lineLogLine logLine = getLogLine();
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.DEBUG.toString(), EELFResourceManager.getIdentifier(eelfLogCode),
- EELFResourceManager.format(eelfLogCode, arguments),
- (fields == null) ? new LogFields() : fields);
-
- // Pass our log string to the EELF logging framework.
- eelfLogger.debug(logLine.getFormattedLine());
- } else {
- eelfLogger.error(BAD_ENUM_MSG + logCode.toString());
- }
- }
-
- @Override
- public void warn(Enum logCode, String... arguments) {
- warn(logCode, new LogFields(), arguments);
- }
-
- @Override
- public void warn(Enum logCode, LogFields fields, String... arguments) {
-
- // We expect our log code to be compatible with the templating
- // functionality provided by the EELF framework, so make sure
- // that this is the case before we try to decode our it.
- if (logCode instanceof LogMessageEnum) {
- // Cast our error code enum to make the EELF framework happy.
- LogMessageEnum eelfLogCode = (LogMessageEnum) logCode;
-
- // Initialize the log line
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.WARN.toString(), EELFResourceManager.getIdentifier(eelfLogCode),
- EELFResourceManager.format(eelfLogCode, arguments),
- (fields == null) ? new LogFields() : fields);
-
- // Pass our log string to the EELF logging framework.
- eelfLogger.warn(logLine.getFormattedLine());
- } else {
- eelfLogger.error(BAD_ENUM_MSG + logCode.toString());
- }
- }
-
- @Override
- public void trace(Enum logCode, String... arguments) {
- trace(logCode, new LogFields(), arguments);
- }
-
- @Override
- public void trace(Enum logCode, LogFields fields, String... arguments) {
-
- // We expect our log code to be compatible with the templating
- // functionality provided by the EELF framework, so make sure
- // that this is the case before we try to decode our it.
- if (logCode instanceof LogMessageEnum) {
- // Cast our error code enum to make the EELF framework happy.
- LogMessageEnum eelfLogCode = (LogMessageEnum) logCode;
-
- // Initialize the log line
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.TRACE.toString(), EELFResourceManager.getIdentifier(eelfLogCode),
- EELFResourceManager.format(eelfLogCode, arguments),
- (fields == null) ? new LogFields() : fields);
-
- // Pass our log string to the EELF logging framework.
- eelfLogger.trace(logLine.getFormattedLine());
-
- } else {
- eelfLogger.error(BAD_ENUM_MSG + logCode.toString());
- }
- }
-
- @Override
- public void error(Enum logCode, String... arguments) {
- error(logCode, new LogFields(), arguments);
- }
-
- @Override
- public void error(Enum logCode, LogFields fields, String... arguments) {
-
- // We expect our log code to be compatible with the templating
- // functionality provided by the EELF framework, so make sure
- // that this is the case before we try to decode it.
- if (logCode instanceof LogMessageEnum) {
-
- // Cast our error code enum to make the EELF framework happy.
- LogMessageEnum eelfLogCode = (LogMessageEnum) logCode;
-
- // Initialize the log line
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.ERROR.toString(), EELFResourceManager.getIdentifier(eelfLogCode),
- EELFResourceManager.format(eelfLogCode, arguments),
- (fields == null) ? new LogFields() : fields);
-
- // Pass our log string to the EELF logging framework.
- eelfLogger.error(logLine.getFormattedLine());
-
- } else {
- eelfLogger.error(BAD_ENUM_MSG + logCode.toString());
- }
- }
-
- @Override
- public void error(Enum logCode, Throwable ex, String... arguments) {
- error(logCode, new LogFields(), ex, arguments);
- }
-
- @Override
- public void error(Enum logCode, LogFields fields, Throwable ex, String... arguments) {
-
- // We expect our log code to be compatible with the templating
- // functionality provided by the EELF framework, so make sure
- // that this is the case before we try to decode it.
- if (logCode instanceof LogMessageEnum) {
- // Cast our error code enum to make the EELF framework happy.
- LogMessageEnum eelfLogCode = (LogMessageEnum) logCode;
-
- // Initialize the log line
- LogLine logLine = getLogLine();
- initLogLine(logLine, Level.ERROR.toString(), EELFResourceManager.getIdentifier(eelfLogCode),
- EELFResourceManager.format(eelfLogCode, arguments),
- (fields == null) ? new LogFields() : fields);
-
- // Pass our log string to the EELF logging framework.
- eelfLogger.error(logLine.getFormattedLine(), ex);
-
- } else {
- eelfLogger.error(BAD_ENUM_MSG + logCode.toString());
- }
- }
-
- @Override
- public String formatMsg(Enum logCode, String... arguments) {
- return EELFResourceManager.getMessage((EELFResolvableErrorEnum) logCode, arguments);
- }
-
- private LogLine getLogLine() {
- if (logLineType == LogLineType.AUDIT) {
- return new AuditLogLine();
- }
-
- if (logLineType == LogLineType.ERROR) {
- return new ErrorLogLine();
- }
-
- if (logLineType == LogLineType.METRICS) {
- return new MetricsLogLine();
- }
-
- eelfLogger.warn("Unsupported LogLineType: " + logLineType);
- return null;
- }
-}
diff --git a/eelf-logging/src/main/java/org/openecomp/cl/eelf/AuditLogLine.java b/eelf-logging/src/main/java/org/openecomp/cl/eelf/AuditLogLine.java
deleted file mode 100644
index c1bfb19..0000000
--- a/eelf-logging/src/main/java/org/openecomp/cl/eelf/AuditLogLine.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.cl.eelf;
-
-import org.openecomp.cl.api.LogLine;
-import org.openecomp.cl.mdc.MdcContext;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/** This class is used to help standardize how log lines are written and provide
- * profiling info. */
-public class AuditLogLine extends LogLine {
-
- /** (non-Javadoc)
- * @see org.openecomp.cl.api.LogLine#getFormattedLine()
- */
- public String getFormattedLine() {
-
- // calculate start/end/elapsed times
- Date currentDateTime = new Date();
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
- String startTimeString = getMdcValue(MdcContext.MDC_START_TIME);
- String endTimeString = formatter.format(currentDateTime);
- long elapsedTime = 0;
- Date startDateTime;
- try {
- startDateTime = formatter.parse(startTimeString);
- elapsedTime = currentDateTime.getTime() - startDateTime.getTime();
- } catch (ParseException e) {
- // Leave an elapsed time of 0 if the start time was not properly formatted
- }
- String elapsedTimeString = Long.toString(elapsedTime);
-
- return startTimeString + "|" + // 1 start time
- endTimeString + "|" + // 2 end time
- getMdcValue(MdcContext.MDC_REQUEST_ID) + "|" + // 3 transaction id
- getMdcValue(MdcContext.MDC_SERVICE_INSTANCE_ID) + "|" + // 4 service instance
- Thread.currentThread().getName() + "|" + // 5 thread id
- getMdcValue(MdcContext.MDC_SERVER_FQDN) + "|" + // 6 physical/virtual server name
- getMdcValue(MdcContext.MDC_SERVICE_NAME) + "|" + // 7 service name
- getMdcValue(MdcContext.MDC_PARTNER_NAME) + "|" + // 8 partner name
- fieldValue(DefinedFields.STATUS_CODE) + "|" + // 9 status code
- fieldValue(DefinedFields.RESPONSE_CODE) + "|" + // 10 response code
- fieldValue(DefinedFields.RESPONSE_DESCRIPTION) + "|" + // 11 response description
- fieldValue(DefinedFields.INSTANCE_UUID) + "|" + // 12 instance UUID
- level + "|" + // 13 log level
- fieldValue(DefinedFields.SEVERITY) + "|" + // 14 log severity
- fieldValue(DefinedFields.SERVER_IP) + "|" + // 15 server ip
- elapsedTimeString + "|" + // 16 elapsed time
- getMdcValue(MdcContext.MDC_SERVER_FQDN) + "|" + // 17 server name
- getMdcValue(MdcContext.MDC_CLIENT_ADDRESS) + "|" + // 18 client ip address
- fieldValue(DefinedFields.CLASS_NAME) + "|" + // 19 class name
- "" + "|" + // 20 deprecated
- fieldValue(DefinedFields.PROCESS_KEY) + "|" + // 21 process key
- fieldValue(DefinedFields.CUSTOM_1) + "|" + // 22 custom 1
- fieldValue(DefinedFields.CUSTOM_2) + "|" + // 23 custom 2
- fieldValue(DefinedFields.CUSTOM_3) + "|" + // 24 custom 3
- fieldValue(DefinedFields.CUSTOM_4) + "|" + // 25 custom 4
- message; // 26 details
- }
-}
diff --git a/eelf-logging/src/main/java/org/openecomp/cl/eelf/ErrorLogLine.java b/eelf-logging/src/main/java/org/openecomp/cl/eelf/ErrorLogLine.java
deleted file mode 100644
index 00ddbc0..0000000
--- a/eelf-logging/src/main/java/org/openecomp/cl/eelf/ErrorLogLine.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.cl.eelf;
-
-import org.openecomp.cl.api.LogLine;
-
-
-/** This class is used to help standardize how log lines are written and provide
- * profiling info. */
-public class ErrorLogLine extends LogLine {
-
- /** (non-Javadoc)
- * @see org.openecomp.cl.api.LogLine#getFormattedLine()
- */
- public String getFormattedLine() {
-
- // The error logger fields should be defined in logback.xml using the following pattern:
- // %d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%mdc{RequestId}|%thread|<AppName>|%mdc{PartnerName}|%logger||%.-5level|%msg%n"
- return logCode + "|" + // 9 error code
- message + "|" + // 10 log message
- ""; // 11 extra details
-
- }
-}
diff --git a/eelf-logging/src/main/java/org/openecomp/cl/eelf/LogMessageEnum.java b/eelf-logging/src/main/java/org/openecomp/cl/eelf/LogMessageEnum.java
deleted file mode 100644
index f6d99cb..0000000
--- a/eelf-logging/src/main/java/org/openecomp/cl/eelf/LogMessageEnum.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.cl.eelf;
-
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import com.att.eelf.i18n.EELFResourceManager;
-
-/** This is a placeholder which client-specific message key enumerations should
- * implement in order to tie into the log template functionality of the EELF
- * framework. */
-public interface LogMessageEnum extends EELFResolvableErrorEnum {
-
-}
diff --git a/eelf-logging/src/main/java/org/openecomp/cl/eelf/LoggerFactory.java b/eelf-logging/src/main/java/org/openecomp/cl/eelf/LoggerFactory.java
deleted file mode 100644
index b0a7c3b..0000000
--- a/eelf-logging/src/main/java/org/openecomp/cl/eelf/LoggerFactory.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.cl.eelf;
-
-import com.att.eelf.configuration.EELFManager;
-
-import org.openecomp.cl.api.LogLine.LogLineType;
-import org.openecomp.cl.api.Logger;
-import org.openecomp.cl.api.LoggerFactoryInterface;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/** This is an implementation of the {@link LoggerFactoryInterface} which
- * constructs a {@link Logger} implementation which is compatible with the EELF
- * framework. */
-public class LoggerFactory implements LoggerFactoryInterface {
-
- /** The instance for our factory singleton. */
- private static LoggerFactory instance;
-
- /** An instance of the log factory provided by the EELF framework. We will use
- * this to get an actual EELF logger instance that we will wrap within our
- * own, more generalized logger. */
- private EELFManager eelfManager;
-
- /** This cache maintains a mapping of logger names to instances so that if a
- * logger with the same name is requested multiple times we can return the
- * same instance each time. */
- private Map<String, Logger> errorLoggerCache = new HashMap<String, Logger>();
-
- /** This cache maintains a mapping of metric logger names to instances so that
- * if a logger with the same name is requested multiple times we can return
- * the same instance each time. */
- private Map<String, Logger> metricLoggerCache = new HashMap<String, Logger>();
-
- /** This cache maintains a mapping of audit logger names to instances so that
- * if a logger with the same name is requested multiple times we can return
- * the same instance each time. */
- private Map<String, Logger> auditLoggerCache = new HashMap<String, Logger>();
-
- /** Returns the single instance of our factory singleton.
- *
- * @return - An instance of the {@link LoggerFactory} */
- public static synchronized LoggerFactory getInstance() {
-
- // If we don't already have an instance then create it now.
- if (instance == null) {
- instance = new LoggerFactory();
- }
-
- // Return our singleton instance.
- return instance;
- }
-
- /**
- * Instantiates a new {@link LoggerFactory}.
- */
- protected LoggerFactory() {
-
- // We need an instance of the factory provided by the EELF
- // framework so that we can instantiate the EELF logger that
- // we will be wrapping, so get one now.
- if (eelfManager == null) {
- eelfManager = EELFManager.getInstance();
- }
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.ecomp.cl.api.LoggerFactoryInterface#getLogger(java.lang.String)
- */
- public Logger getLogger(String name) {
-
- // Check the cache to see if we have already instantiated a logger
- // with the supplied name.
- if (!errorLoggerCache.containsKey(name)) {
-
- // Nothing in the cache, so let's instantiate a logger now.
- Logger logger = new AaiLoggerAdapter(eelfManager.getLogger(name), LogLineType.ERROR, name);
- errorLoggerCache.put(name, logger);
- }
-
- // Return the requested logger instance.
- return errorLoggerCache.get(name);
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.ecomp.cl.api.LoggerFactoryInterface#getLogger(java.lang.Class)
- */
- public Logger getLogger(Class<?> clazz) {
-
- return getLogger(clazz.getName());
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.ecomp.cl.api.LoggerFactoryInterface#getAuditLogger(java.lang.String)
- */
- public Logger getAuditLogger(String name) {
-
- // Check the cache to see if we have already instantiated a logger
- // with the supplied name.
- if (!auditLoggerCache.containsKey(name)) {
-
- // Nothing in the cache, so let's instantiate a logger now.
- Logger logger = new AaiLoggerAdapter(eelfManager.getAuditLogger(), LogLineType.AUDIT, name);
- auditLoggerCache.put(name, logger);
- }
-
- // Return the requested logger instance.
- return auditLoggerCache.get(name);
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.ecomp.cl.api.LoggerFactoryInterface#getAuditLogger(java.lang.Class)
- */
- public Logger getAuditLogger(Class<?> clazz) {
-
- return getAuditLogger(clazz.getName());
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.ecomp.cl.api.LoggerFactoryInterface#getMetricsLogger(java.lang.String)
- */
- public Logger getMetricsLogger(String name) {
-
- // Check the cache to see if we have already instantiated a logger
- // with the supplied name.
- if (!metricLoggerCache.containsKey(name)) {
-
- // Nothing in the cache, so let's instantiate a logger now.
- Logger logger = new AaiLoggerAdapter(eelfManager.getMetricsLogger(), LogLineType.METRICS,
- name);
- metricLoggerCache.put(name, logger);
- }
-
- // Return the requested logger instance.
- return metricLoggerCache.get(name);
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.ecomp.cl.api.LoggerFactoryInterface#getMetricsLogger(java.lang.Class)
- */
- public Logger getMetricsLogger(Class<?> clazz) {
-
- return getMetricsLogger(clazz.getName());
- }
-}
diff --git a/eelf-logging/src/main/java/org/openecomp/cl/eelf/MetricsLogLine.java b/eelf-logging/src/main/java/org/openecomp/cl/eelf/MetricsLogLine.java
deleted file mode 100644
index 454fb15..0000000
--- a/eelf-logging/src/main/java/org/openecomp/cl/eelf/MetricsLogLine.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.cl.eelf;
-
-import org.openecomp.cl.api.LogLine;
-import org.openecomp.cl.mdc.MdcContext;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/** This class is used to help standardize how log lines are written and provide
- * profiling info. */
-public class MetricsLogLine extends LogLine {
-
- /** Return the log line based on what we have so far. */
- public String getFormattedLine() {
-
- // Calculate start/end/elapsed times
- Date currentDateTime = new Date();
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
- String startTimeString = getMdcValue(MdcContext.MDC_START_TIME);
- String endTimeString = formatter.format(currentDateTime);
- long elapsedTime = 0;
- Date startDateTime;
- try {
- startDateTime = formatter.parse(startTimeString);
- elapsedTime = currentDateTime.getTime() - startDateTime.getTime();
- } catch (ParseException e) {
- // Leave an elapsed time of 0 if the start time was not properly formatted
- }
- String elapsedTimeString = Long.toString(elapsedTime);
-
- return startTimeString + "|" + // 1 start time
- endTimeString + "|" + // 2 end time
- getMdcValue(MdcContext.MDC_REQUEST_ID) + "|" + // 3 transaction id
- getMdcValue(MdcContext.MDC_SERVICE_INSTANCE_ID) + "|" + // 4 service instance
- Thread.currentThread().getName() + "|" + // 5 thread id
- getMdcValue(MdcContext.MDC_SERVER_FQDN) + "|" + // 6 physical/virtual server name
- getMdcValue(MdcContext.MDC_SERVICE_NAME) + "|" + // 7 service name
- getMdcValue(MdcContext.MDC_PARTNER_NAME) + "|" + // 8 partner name
- fieldValue(DefinedFields.TARGET_ENTITY) + "|" + // 9 target entity
- fieldValue(DefinedFields.TARGET_SVC_NAME) + "|" + // 10 target service
- fieldValue(DefinedFields.STATUS_CODE) + "|" + // 11 status code
- fieldValue(DefinedFields.RESPONSE_CODE) + "|" + // 12 response code
- fieldValue(DefinedFields.RESPONSE_DESCRIPTION) + "|" + // 13 response description
- fieldValue(DefinedFields.INSTANCE_UUID) + "|" + // 14 instance UUID
- level + "|" + // 15 log level
- fieldValue(DefinedFields.SEVERITY) + "|" + // 16 log severity
- fieldValue(DefinedFields.SERVER_IP) + "|" + // 17 server ip
- elapsedTimeString + "|" + // 18 elapsed time
- getMdcValue(MdcContext.MDC_SERVER_FQDN) + "|" + // 19 server name
- fieldValue(DefinedFields.CLIENT_IP) + "|" + // 20 client ip address
- fieldValue(DefinedFields.CLASS_NAME) + "|" + // 21 class name
- "" + "|" + // 22 deprecated
- fieldValue(DefinedFields.PROCESS_KEY) + "|" + // 23 process key
- fieldValue(DefinedFields.TARGET_ENTITY) + "|" + // 24 target virtual entity
- fieldValue(DefinedFields.CUSTOM_1) + "|" + // 25 custom 1
- fieldValue(DefinedFields.CUSTOM_2) + "|" + // 26 custom 2
- fieldValue(DefinedFields.CUSTOM_3) + "|" + // 27 custom 3
- fieldValue(DefinedFields.CUSTOM_4) + "|" + // 28 custom 4
- message; // 29 detail message
- }
-
-}