diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-12-18 22:48:42 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-12-18 22:48:42 +1300 |
commit | 58e829a30021e30d51e09fd085d16f6a701b6d98 (patch) | |
tree | 3e74786dbbbc94f88f8781f3cdc1a389559abb63 /src | |
parent | f72eade8742022502e69b300296c8ac1fbf35b25 (diff) | |
download | traccar-server-58e829a30021e30d51e09fd085d16f6a701b6d98.tar.gz traccar-server-58e829a30021e30d51e09fd085d16f6a701b6d98.tar.bz2 traccar-server-58e829a30021e30d51e09fd085d16f6a701b6d98.zip |
Fix logger
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/Server.java | 7 | ||||
-rw-r--r-- | src/org/traccar/helper/Log.java | 11 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index 2167a7933..07296d945 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -202,13 +202,6 @@ public class Server { } }); - // Remove old logging handlers - Handler[] handlers = Logger.getLogger("").getHandlers(); - for(Handler handler : handlers) { - Logger.getLogger("").removeHandler(handler); - } - - Log.getLogger().setLevel(Level.ALL); Log.getLogger().addHandler(file); } } diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java index 03de36c46..983171b72 100644 --- a/src/org/traccar/helper/Log.java +++ b/src/org/traccar/helper/Log.java @@ -23,13 +23,20 @@ import java.util.logging.Logger; */ public class Log { - private static String TRACCAR_LOGGER_NAME = "traccar"; + private static final String TRACCAR_LOGGER_NAME = "traccar"; + + private static Logger logger = null; /** * Return global logger */ public static Logger getLogger() { - return Logger.getLogger(TRACCAR_LOGGER_NAME); + if (logger == null) { + logger = Logger.getLogger(TRACCAR_LOGGER_NAME); + logger.setUseParentHandlers(false); + logger.setLevel(Level.ALL); + } + return logger; } private static void write(Level level, String msg) { |