diff options
Diffstat (limited to 'common/src')
-rw-r--r-- | common/src/main/java/at/gv/egovernment/moa/logging/Logger.java | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java index 184be20cb..6999656ab 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java @@ -50,22 +50,22 @@ public class Logger { /** The Constant instances. */ - private static final Map<String, org.apache.log4j.Logger> instances = new HashMap<String, org.apache.log4j.Logger>(); + private static final Map<String, org.slf4j.Logger> instances = new HashMap<String, org.slf4j.Logger>(); /** * Gets the logger. * * @return the logger */ - private static synchronized org.apache.log4j.Logger getLogger() { + private static synchronized org.slf4j.Logger getLogger() { String className = Thread.currentThread().getStackTrace()[3].getClassName(); - org.apache.log4j.Logger logger = instances.get(className); + org.slf4j.Logger logger = instances.get(className); if (logger != null) { return logger; } - logger = org.apache.log4j.Logger.getLogger(className); + logger = org.slf4j.LoggerFactory.getLogger(className); instances.put(className, logger); return logger; @@ -78,7 +78,7 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isTraceEnabled() { - org.apache.log4j.Logger logger = getLogger(); + org.slf4j.Logger logger = getLogger(); return logger.isTraceEnabled(); } @@ -90,7 +90,7 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isTraceEnabled(String hierarchy) { - org.apache.log4j.Logger logger = getLogger(); + org.slf4j.Logger logger = getLogger(); return logger.isTraceEnabled(); } @@ -100,8 +100,8 @@ public class Logger { * @param message The message to trace. */ public static void trace(Object message) { - org.apache.log4j.Logger logger = getLogger(); - logger.trace(message); + org.slf4j.Logger logger = getLogger(); + logger.trace(message.toString()); } /** @@ -111,7 +111,7 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isDebugEnabled() { - org.apache.log4j.Logger logger = getLogger(); + org.slf4j.Logger logger = getLogger(); return logger.isDebugEnabled(); } @@ -123,7 +123,7 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isDebugEnabled(String hierarchy) { - org.apache.log4j.Logger logger = getLogger(); + org.slf4j.Logger logger = getLogger(); return logger.isDebugEnabled(); } @@ -133,8 +133,8 @@ public class Logger { * @param message The message to log. */ public static void debug(Object message) { - org.apache.log4j.Logger logger = getLogger(); - logger.debug(message); + org.slf4j.Logger logger = getLogger(); + logger.debug(message.toString()); } /** @@ -143,8 +143,8 @@ public class Logger { * @param message The message to log. */ public static void info(Object message) { - org.apache.log4j.Logger logger = getLogger(); - logger.info(message); + org.slf4j.Logger logger = getLogger(); + logger.info(message.toString()); } /** @@ -153,8 +153,8 @@ public class Logger { * @param message The message to log. */ public static void warn(Object message) { - org.apache.log4j.Logger logger = getLogger(); - logger.warn(message); + org.slf4j.Logger logger = getLogger(); + logger.warn(message.toString()); } /** @@ -164,8 +164,8 @@ public class Logger { * @param t An exception that may be the cause of the warning. */ public static void warn(Object message, Throwable t) { - org.apache.log4j.Logger logger = getLogger(); - logger.warn(message, t); + org.slf4j.Logger logger = getLogger(); + logger.warn(message.toString(), t); } /** @@ -174,8 +174,8 @@ public class Logger { * @param message The message to log. */ public static void error(Object message) { - org.apache.log4j.Logger logger = getLogger(); - logger.error(message); + org.slf4j.Logger logger = getLogger(); + logger.error(message.toString()); } /** @@ -185,8 +185,8 @@ public class Logger { * @param t An exception that may be the cause of the error. */ public static void error(Object message, Throwable t) { - org.apache.log4j.Logger logger = getLogger(); - logger.error(message, t); + org.slf4j.Logger logger = getLogger(); + logger.error(message.toString(), t); } /** @@ -195,8 +195,7 @@ public class Logger { * @param message The message to log. */ public static void fatal(Object message) { - org.apache.log4j.Logger logger = getLogger(); - logger.fatal(message); + error(message); } /** @@ -206,7 +205,6 @@ public class Logger { * @param t An exception that may be the cause of the error. */ public static void fatal(Object message, Throwable t) { - org.apache.log4j.Logger logger = getLogger(); - logger.fatal(message, t); + error(message, t); } } |