Log which gson style is being used
Different gson providers may be used for REST APIs. Updated the code
to identify which was being used.
Change-Id: I8ffbda7409142ec728e217a87c9bcba3c34b814b
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
diff --git a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
index 6906696..fc8e23e 100644
--- a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
+++ b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
@@ -36,6 +36,8 @@
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Provider that serializes and de-serializes JSON via gson.
@@ -45,6 +47,8 @@
@Produces(MediaType.WILDCARD)
public class GsonMessageBodyHandler implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
+ public static final Logger logger = LoggerFactory.getLogger(GsonMessageBodyHandler.class);
+
/**
* Object to be used to serialize and de-serialize.
*/
@@ -55,6 +59,8 @@
*/
public GsonMessageBodyHandler() {
this(new Gson());
+
+ logger.info("Using GSON for REST calls");
}
/**
diff --git a/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java b/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java
index a1c54af..b2648b0 100644
--- a/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java
+++ b/gson/src/main/java/org/onap/policy/common/gson/JacksonHandler.java
@@ -37,6 +37,8 @@
*/
public JacksonHandler() {
this(new GsonBuilder());
+
+ logger.info("Using GSON with Jackson behaviors for REST calls");
}
/**
@@ -49,8 +51,6 @@
.registerTypeAdapterFactory(new JacksonMethodAdapterFactory())
.setExclusionStrategies(new JacksonExclusionStrategy())
.create());
-
- logger.info("Using GSON for REST calls");
}
}