Remove ECOMP in headers
[clamp.git] / src / main / java / org / onap / clamp / clds / util / LoggingUtils.java
index bca4134..e4f9ce3 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================\r
  * ONAP CLAMP\r
  * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights\r
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights\r
  *                             reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * limitations under the License.\r
  * ============LICENSE_END============================================\r
  * ===================================================================\r
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * \r
  */\r
 \r
 package org.onap.clamp.clds.util;\r
 \r
+import java.net.InetAddress;\r
+import java.net.UnknownHostException;\r
 import java.text.DateFormat;\r
 import java.text.SimpleDateFormat;\r
 import java.util.Date;\r
@@ -31,11 +33,16 @@ import java.util.UUID;
 import javax.validation.constraints.NotNull;\r
 import org.apache.log4j.MDC;\r
 \r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
+\r
 /**\r
  * This class handles the special info that appear in the log, like RequestID,\r
  * time context, ...\r
  */\r
 public final class LoggingUtils {\r
+       \r
+       protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LoggingUtils.class);\r
 \r
     private static final DateFormat DATE_FORMAT = createDateFormat();\r
 \r
@@ -55,6 +62,12 @@ public final class LoggingUtils {
         MDC.put("RequestId", UUID.randomUUID().toString());\r
         MDC.put("ServiceName", service);\r
         MDC.put("PartnerName", partner);\r
+        try {\r
+               MDC.put("ServerFQDN", InetAddress.getLocalHost().getCanonicalHostName());\r
+               MDC.put("ServerIPAddress", InetAddress.getLocalHost().getHostAddress());\r
+        } catch (UnknownHostException e) {\r
+               logger.error("Failed to initiate setRequestContext", e);\r
+               }\r
     }\r
 \r
     /**\r