diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-20 20:18:21 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-20 20:18:21 +1200 |
commit | 569ee68a9219a33c2a4bdd2bc43dd4f8e8cdfed4 (patch) | |
tree | 4e656222dd63b98d19189de24146d70610d04a86 /src/org | |
parent | f03fbcc96e804c232a873d63eaf55060685ad3da (diff) | |
download | traccar-server-569ee68a9219a33c2a4bdd2bc43dd4f8e8cdfed4.tar.gz traccar-server-569ee68a9219a33c2a4bdd2bc43dd4f8e8cdfed4.tar.bz2 traccar-server-569ee68a9219a33c2a4bdd2bc43dd4f8e8cdfed4.zip |
Fix packet logging
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/BasePipelineFactory.java | 3 | ||||
-rw-r--r-- | src/org/traccar/ServerManager.java | 9 | ||||
-rw-r--r-- | src/org/traccar/helper/Log.java | 17 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java index e5aa5f76b..9d2ab5071 100644 --- a/src/org/traccar/BasePipelineFactory.java +++ b/src/org/traccar/BasePipelineFactory.java @@ -70,9 +70,8 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { // Append hex message if (event.getMessage() instanceof ChannelBuffer) { - msg.append(" - (HEX: "); + msg.append(" - HEX: "); msg.append(ChannelBuffers.hexDump((ChannelBuffer) event.getMessage())); - msg.append(")"); } Log.debug(msg.toString()); diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index e478c6f2f..95f8c7b58 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -93,7 +93,12 @@ public class ServerManager { dataManager = new DatabaseDataManager(properties); - Log.setupLogger(properties); + // Init logger + loggerEnabled = Boolean.valueOf(properties.getProperty("logger.enable")); + if (loggerEnabled) { + Log.setupLogger(properties); + } + initGeocoder(properties); initXexunServer("xexun"); @@ -151,7 +156,7 @@ public class ServerManager { initGatorServer("gator"); initNoranServer("noran"); initM2mServer("m2m"); - + // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { webServer = new WebServer(properties); diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java index f79fce79d..3c173f71e 100644 --- a/src/org/traccar/helper/Log.java +++ b/src/org/traccar/helper/Log.java @@ -32,19 +32,16 @@ public class Log { private static Logger logger = null; public static void setupLogger(Properties properties) throws IOException { - if (Boolean.valueOf(properties.getProperty("logger.enable"))) { - Layout layout = new PatternLayout( - "%d{yyyy-MM-dd HH:mm:ss} %5p: %m%n"); + Layout layout = new PatternLayout("%d{yyyy-MM-dd HH:mm:ss} %5p: %m%n"); - Appender appender = new DailyRollingFileAppender( - layout, properties.getProperty("logger.file"), "'.'yyyyMMdd"); + Appender appender = new DailyRollingFileAppender( + layout, properties.getProperty("logger.file"), "'.'yyyyMMdd"); - LogManager.resetConfiguration(); - logger = Logger.getLogger(LOGGER_NAME); - logger.addAppender(appender); - logger.setLevel(Level.DEBUG); - } + LogManager.resetConfiguration(); + logger = Logger.getLogger(LOGGER_NAME); + logger.addAppender(appender); + logger.setLevel(Level.ALL); } public static Logger getLogger() { |