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/BaseProtocolDecoder.java | |
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/BaseProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/BaseProtocolDecoder.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java index d9ab60e3a..e940d96c4 100644 --- a/src/org/traccar/BaseProtocolDecoder.java +++ b/src/org/traccar/BaseProtocolDecoder.java @@ -17,7 +17,8 @@ package org.traccar; import io.netty.channel.Channel; import io.netty.channel.socket.DatagramChannel; -import org.traccar.helper.Log; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.helper.UnitsConverter; import org.traccar.model.Device; import org.traccar.model.Position; @@ -33,6 +34,8 @@ import java.sql.SQLException; public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { + private static final Logger LOGGER = LoggerFactory.getLogger(BaseProtocolDecoder.class); + private final Protocol protocol; public long addUnknownDevice(String uniqueId) { @@ -49,7 +52,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { try { Context.getDeviceManager().addItem(device); - Log.info("Automatically registered device " + uniqueId); + LOGGER.info("Automatically registered device " + uniqueId); if (defaultGroupId != 0) { Context.getPermissionsManager().refreshDeviceAndGroupPermissions(); @@ -58,7 +61,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { return device.getId(); } catch (SQLException e) { - Log.warning(e); + LOGGER.warn(null, e); return 0; } } @@ -107,7 +110,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { int timeZoneOffset = Context.getConfig().getInteger(getProtocolName() + ".timezone", 0); if (timeZoneOffset != 0) { result.setRawOffset(timeZoneOffset * 1000); - Log.warning("Config parameter " + getProtocolName() + ".timezone is deprecated"); + LOGGER.warn("Config parameter " + getProtocolName() + ".timezone is deprecated"); } } return result; @@ -131,7 +134,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { } } } catch (Exception e) { - Log.warning(e); + LOGGER.warn(null, e); } if (deviceId == 0 && Context.getConfig().getBoolean("database.registerUnknown")) { return addUnknownDevice(uniqueIds[0]); @@ -151,7 +154,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { if (remoteAddress != null) { message.append(" (").append(((InetSocketAddress) remoteAddress).getHostString()).append(")"); } - Log.warning(message.toString()); + LOGGER.warn(message.toString()); } return 0; } |