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/helper/LogAction.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/helper/LogAction.java')
-rw-r--r-- | src/org/traccar/helper/LogAction.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/org/traccar/helper/LogAction.java b/src/org/traccar/helper/LogAction.java index 2f575537d..db13337b8 100644 --- a/src/org/traccar/helper/LogAction.java +++ b/src/org/traccar/helper/LogAction.java @@ -18,10 +18,14 @@ package org.traccar.helper; import java.beans.Introspector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.model.BaseModel; public final class LogAction { + private static final Logger LOGGER = LoggerFactory.getLogger(LogAction.class); + private LogAction() { } @@ -71,26 +75,25 @@ public final class LogAction { } public static void resetDeviceAccumulators(long userId, long deviceId) { - log(String.format(PATTERN_DEVICE_ACCUMULATORS, userId, ACTION_DEVICE_ACCUMULATORS, deviceId)); + LOGGER.info(String.format( + PATTERN_DEVICE_ACCUMULATORS, userId, ACTION_DEVICE_ACCUMULATORS, deviceId)); } private static void logObjectAction(String action, long userId, Class<?> clazz, long objectId) { - log(String.format(PATTERN_OBJECT, userId, action, Introspector.decapitalize(clazz.getSimpleName()), objectId)); + LOGGER.info(String.format( + PATTERN_OBJECT, userId, action, Introspector.decapitalize(clazz.getSimpleName()), objectId)); } private static void logLinkAction(String action, long userId, Class<?> owner, long ownerId, Class<?> property, long propertyId) { - log(String.format(PATTERN_LINK, userId, action, + LOGGER.info(String.format( + PATTERN_LINK, userId, action, Introspector.decapitalize(owner.getSimpleName()), ownerId, Introspector.decapitalize(property.getSimpleName()), propertyId)); } private static void logLoginAction(String action, long userId) { - log(String.format(PATTERN_LOGIN, userId, action)); - } - - private static void log(String msg) { - Log.info(msg); + LOGGER.info(String.format(PATTERN_LOGIN, userId, action)); } } |