diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/pom.xml | 27 | ||||
-rw-r--r-- | common/src/main/java/at/gv/egovernment/moa/logging/Logger.java | 50 |
2 files changed, 30 insertions, 47 deletions
diff --git a/common/pom.xml b/common/pom.xml index e702c5e66..72cf702bc 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -74,11 +74,6 @@ <artifactId>slf4j-api</artifactId> <version>1.7.10</version> </dependency> -<!-- <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <version>1.7.6</version> - </dependency> --> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> @@ -86,28 +81,18 @@ </dependency> <dependency> <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> + <artifactId>jul-to-slf4j</artifactId> <version>1.7.10</version> </dependency> -<!-- <dependency> - <groupId>org.slf4j</groupId> - <artifactId>log4j-over-slf4j</artifactId> - <version>1.7.6</version> - </dependency> --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.7.10</version> + </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.7.10</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jul-to-slf4j</artifactId> - <version>1.7.10</version> - </dependency> </dependencies> <build> 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); } } |