diff --git a/logging-api/pom.xml b/logging-api/pom.xml index 91f26e9..6fb7664 100644 --- a/logging-api/pom.xml +++ b/logging-api/pom.xml @@ -18,18 +18,19 @@ 1.0.1-5 + 1.7.21 com.cisco.oss.foundation foundation-common-base - 1.0.1-7 + 1.0.1-8 4.0.0 com.cisco.oss.foundation logging-api logging-api - 1.0.2-3-SNAPSHOT + 1.1.0-1-SNAPSHOT This project is the logging api library in the cisco vss foundation runtime https://github.com/foundation-runtime/logging/tree/master/logging-api jar @@ -92,6 +93,15 @@ + + + + org.slf4j + slf4j-api + 1.7.21 + + + org.jdom @@ -108,5 +118,44 @@ reflections 0.9.8 + + com.google.auto.service + auto-service + 1.0-rc2 + + + com.squareup + javawriter + 2.5.1 + + + commons-configuration + commons-configuration + 1.10 + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + org.jboss.resteasy + jaxrs-api + 3.0.12.Final + provided + + + org.springframework + spring-web + 4.2.0.RELEASE + provided + + + com.cisco.oss.foundation + configuration-api + 1.0.2-4 + provided + diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/Component.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/Component.java similarity index 100% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/Component.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/Component.java diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/ComponentsMultiThread.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/ComponentsMultiThread.java similarity index 100% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/ComponentsMultiThread.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/ComponentsMultiThread.java diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/ConfigurationUtil.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/ConfigurationUtil.java similarity index 94% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/ConfigurationUtil.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/ConfigurationUtil.java index 9ecba05..409a968 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/ConfigurationUtil.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/ConfigurationUtil.java @@ -20,15 +20,15 @@ public enum ConfigurationUtil implements FoundationConfigurationListener { private Environment environment; ConfigurationUtil() { - refresh(); + } @Override public void configurationChanged() { - refresh(); + reloadConfig(); } - private void refresh() { + private void reloadConfig() { if (environment == null) { verbose = ConfigurationFactory.getConfiguration().getBoolean("logging.verbose", false); }else{ @@ -56,5 +56,7 @@ public static void setConfigSource(Environment environment) { if (environment != null && !configuredReady){ INSTANCE.setEnvironment(environment); } + + INSTANCE.reloadConfig(); } } diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/DummyLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/DummyLogger.java similarity index 100% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/DummyLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/DummyLogger.java diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpLogger.java similarity index 97% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpLogger.java index 942567f..dd3d746 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpLogger.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpLogger.java @@ -1,22 +1,18 @@ package com.cisco.oss.foundation.logging.transactions; -import com.cisco.oss.foundation.configuration.ConfigurationFactory; -import org.apache.commons.configuration.Configuration; +import com.cisco.oss.foundation.flowcontext.FlowContextFactory; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Level; import org.slf4j.Logger; - -import com.cisco.oss.foundation.flowcontext.FlowContextFactory; import org.slf4j.LoggerFactory; +import org.slf4j.event.Level; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; -import org.springframework.stereotype.*; +import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; -import java.io.OutputStream; import java.util.Enumeration; import java.util.HashMap; import java.util.List; @@ -28,7 +24,6 @@ * @author abrandwi * */ -@org.springframework.stereotype.Component public class HttpLogger extends TransactionLogger { @@ -42,6 +37,11 @@ private enum HttpVerbosePropertyKey {RequestHeaders, RequestBody, ResponseHeader private Environment environment; public HttpLogger(){ + + } + + @PostConstruct + public void init(){ ConfigurationUtil.setConfigSource(environment); } diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpResponse.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpResponse.java similarity index 99% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpResponse.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpResponse.java index 935fda3..064c529 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpResponse.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpResponse.java @@ -1,13 +1,12 @@ package com.cisco.oss.foundation.logging.transactions; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - public class HttpResponse { private String body; diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpSpringLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpSpringLogger.java similarity index 98% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpSpringLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpSpringLogger.java index 6d9445f..115024f 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpSpringLogger.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/HttpSpringLogger.java @@ -1,16 +1,15 @@ package com.cisco.oss.foundation.logging.transactions; -import com.cisco.oss.foundation.configuration.ConfigurationFactory; import com.google.common.base.Joiner; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Level; +import org.slf4j.event.Level; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.*; +import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import java.util.Enumeration; import java.util.HashMap; @@ -22,7 +21,6 @@ * * @author abrandwi */ -@org.springframework.stereotype.Component public class HttpSpringLogger extends TransactionLogger { private enum HttpPropertyKey {Summary, Method, SourceName, SourcePort, URL, ResponseStatusCode, ResponseContentLength, ResponseBody} @@ -34,6 +32,11 @@ private enum HttpVerbosePropertyKey {RequestHeaders, RequestBody, ResponseHeader private Environment environment; public HttpSpringLogger(){ + + } + + @PostConstruct + public void init(){ ConfigurationUtil.setConfigSource(environment); } diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/JobLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/JobLogger.java similarity index 100% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/JobLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/JobLogger.java diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/MessageQueueLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/MessageQueueLogger.java similarity index 97% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/MessageQueueLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/MessageQueueLogger.java index f85bff3..4a5ef9a 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/MessageQueueLogger.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/MessageQueueLogger.java @@ -1,18 +1,18 @@ package com.cisco.oss.foundation.logging.transactions; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Level; +import org.slf4j.event.Level; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; -import org.springframework.stereotype.*; + +import javax.annotation.PostConstruct; /** * Class for MessageQueue transactions logging * @author abrandwi * */ -@org.springframework.stereotype.Component public class MessageQueueLogger extends TransactionLogger { private enum MessageQueuePropertyKey {NotificationType}; @@ -24,6 +24,11 @@ private enum MessageQueueVerbosePropertyKey {NotificationBody}; private Environment environment; public MessageQueueLogger(){ + + } + + @PostConstruct + public void init(){ ConfigurationUtil.setConfigSource(environment); } diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/ReportLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/ReportLogger.java similarity index 100% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/ReportLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/ReportLogger.java diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/SchedulerLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/SchedulerLogger.java similarity index 99% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/SchedulerLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/SchedulerLogger.java index 9e4d4c9..d1eff9f 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/SchedulerLogger.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/SchedulerLogger.java @@ -1,6 +1,6 @@ package com.cisco.oss.foundation.logging.transactions; -import org.apache.log4j.Level; +import org.slf4j.event.Level; import org.slf4j.Logger; /** diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/TaskLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TaskLogger.java similarity index 99% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/TaskLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TaskLogger.java index e07e28a..1accdf4 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/TaskLogger.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TaskLogger.java @@ -1,6 +1,6 @@ package com.cisco.oss.foundation.logging.transactions; -import org.apache.log4j.Level; +import org.slf4j.event.Level; import org.slf4j.Logger; /** diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/Timer.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/Timer.java similarity index 100% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/Timer.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/Timer.java diff --git a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java similarity index 99% rename from logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java rename to logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java index 5c53b49..1aee87a 100644 --- a/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java +++ b/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java @@ -1,17 +1,16 @@ package com.cisco.oss.foundation.logging.transactions; +import com.cisco.oss.foundation.flowcontext.FlowContextFactory; +import com.cisco.oss.foundation.ip.utils.IpUtils; +import org.slf4j.event.Level; +import org.slf4j.Logger; + import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; -import org.apache.log4j.Level; -import org.slf4j.Logger; - -import com.cisco.oss.foundation.flowcontext.FlowContextFactory; -import com.cisco.oss.foundation.ip.utils.IpUtils; - /** * Abstract class for transactions logging * @author abrandwi @@ -188,7 +187,6 @@ public static void addProperty(String key, String value) { * @param logger * @param auditor * @param instance - * @param flowContextId * @return whether new instance was set to thread-local */ protected static boolean createLoggingAction(final Logger logger, final Logger auditor, final TransactionLogger instance) { diff --git a/logging-log4j/pom.xml b/logging-log4j/pom.xml index 31d1de1..52277f2 100644 --- a/logging-log4j/pom.xml +++ b/logging-log4j/pom.xml @@ -25,7 +25,7 @@ com.cisco.oss.foundation logging-log4j logging-log4j - 1.1.1-2-SNAPSHOT + 1.2.1-0-SNAPSHOT This project is the logging log4j implementation library in the cisco vss foundation runtime https://github.com/foundation-runtime/logging/tree/master/logging-log4j