From 09221ab5695e99b2df1130ea923c39625ec85429 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Thu, 10 Nov 2016 04:50:07 +0700 Subject: using slf4j + logback for logging --- .../src/main/java/com/juick/json/MessageSerializer.java | 8 ++++---- juick-core/src/main/resources/logback.xml | 13 +++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 juick-core/src/main/resources/logback.xml (limited to 'juick-core/src') diff --git a/juick-core/src/main/java/com/juick/json/MessageSerializer.java b/juick-core/src/main/java/com/juick/json/MessageSerializer.java index 9da828c9..3ef903f0 100644 --- a/juick-core/src/main/java/com/juick/json/MessageSerializer.java +++ b/juick-core/src/main/java/com/juick/json/MessageSerializer.java @@ -22,12 +22,12 @@ import com.juick.Tag; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.TimeZone; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.stream.Collectors; /** @@ -36,7 +36,7 @@ import java.util.stream.Collectors; */ public class MessageSerializer extends JSONSerializer { - private final static Logger LOGGER = Logger.getLogger(MessageSerializer.class.getName()); + private final static Logger LOGGER = LoggerFactory.getLogger(MessageSerializer.class); UserSerializer userSerializer = new UserSerializer(); PlaceSerializer placeSerializer = new PlaceSerializer(); @@ -133,7 +133,7 @@ public class MessageSerializer extends JSONSerializer { json.put("photo", photo); } } catch (JSONException e) { - LOGGER.log(Level.SEVERE, "JSON Exception", e); + LOGGER.error("JSON Exception", e); } return json; diff --git a/juick-core/src/main/resources/logback.xml b/juick-core/src/main/resources/logback.xml new file mode 100644 index 00000000..9e3bf16c --- /dev/null +++ b/juick-core/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + \ No newline at end of file -- cgit v1.2.3