diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-14 14:33:49 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-14 14:33:49 +1200 |
commit | b10824bb5769c4abb93e3451673b88efdfb9d467 (patch) | |
tree | c4d04ed2f19d5758a75b702467dbc051c5d0511c /src/org/traccar/web | |
parent | e331573c0df7467fd36ae3eba3c259ed9b1d9253 (diff) | |
download | trackermap-server-b10824bb5769c4abb93e3451673b88efdfb9d467.tar.gz trackermap-server-b10824bb5769c4abb93e3451673b88efdfb9d467.tar.bz2 trackermap-server-b10824bb5769c4abb93e3451673b88efdfb9d467.zip |
Log using slf4j and java logging
Diffstat (limited to 'src/org/traccar/web')
-rw-r--r-- | src/org/traccar/web/ConsoleServlet.java | 7 | ||||
-rw-r--r-- | src/org/traccar/web/CsvBuilder.java | 9 | ||||
-rw-r--r-- | src/org/traccar/web/WebServer.java | 11 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/org/traccar/web/ConsoleServlet.java b/src/org/traccar/web/ConsoleServlet.java index 9b3d8d54b..dddd13b6d 100644 --- a/src/org/traccar/web/ConsoleServlet.java +++ b/src/org/traccar/web/ConsoleServlet.java @@ -17,8 +17,9 @@ package org.traccar.web; import org.h2.server.web.ConnectionInfo; import org.h2.server.web.WebServlet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.Context; -import org.traccar.helper.Log; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -26,6 +27,8 @@ import java.lang.reflect.Method; public class ConsoleServlet extends WebServlet { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleServlet.class); + @Override public void init() { super.init(); @@ -51,7 +54,7 @@ public class ConsoleServlet extends WebServlet { method.invoke(server, true); } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - Log.warning(e); + LOGGER.warn(null, e); } } diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java index fa99f1b18..d5149b528 100644 --- a/src/org/traccar/web/CsvBuilder.java +++ b/src/org/traccar/web/CsvBuilder.java @@ -31,11 +31,14 @@ import com.fasterxml.jackson.core.JsonProcessingException; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.Context; -import org.traccar.helper.Log; public class CsvBuilder { + private static final Logger LOGGER = LoggerFactory.getLogger(CsvBuilder.class); + private static final String LINE_ENDING = "\r\n"; private static final String SEPARATOR = ";"; private static final DateTimeFormatter DATE_FORMAT = ISODateTimeFormat.dateTime(); @@ -103,12 +106,12 @@ public class CsvBuilder { builder.append(map); addSeparator(); } catch (JsonProcessingException e) { - Log.warning(e); + LOGGER.warn(null, e); } } } } catch (IllegalAccessException | InvocationTargetException error) { - Log.warning(error); + LOGGER.warn(null, error); } } } diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java index 13eebf34f..32c336164 100644 --- a/src/org/traccar/web/WebServer.java +++ b/src/org/traccar/web/WebServer.java @@ -32,6 +32,8 @@ import org.eclipse.jetty.webapp.WebAppContext; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.Config; import org.traccar.Context; import org.traccar.api.AsyncSocketServlet; @@ -41,7 +43,6 @@ import org.traccar.api.ObjectMapperProvider; import org.traccar.api.ResourceErrorHandler; import org.traccar.api.SecurityRequestFilter; import org.traccar.api.resource.ServerResource; -import org.traccar.helper.Log; import javax.naming.InitialContext; import javax.servlet.DispatcherType; @@ -56,6 +57,8 @@ import java.util.EnumSet; public class WebServer { + private static final Logger LOGGER = LoggerFactory.getLogger(WebServer.class); + private Server server; private final Config config; private final DataSource dataSource; @@ -150,7 +153,7 @@ public class WebServer { javax.naming.Context context = new InitialContext(); context.bind("java:/DefaultDS", dataSource); } catch (Exception error) { - Log.warning(error); + LOGGER.warn(null, error); } WebAppContext app = new WebAppContext(); @@ -196,7 +199,7 @@ public class WebServer { try { server.start(); } catch (Exception error) { - Log.warning(error); + LOGGER.warn(null, error); } } @@ -204,7 +207,7 @@ public class WebServer { try { server.stop(); } catch (Exception error) { - Log.warning(error); + LOGGER.warn(null, error); } } |