aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-03-20 18:32:14 +0100
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-03-20 18:32:42 +0100
commit185aa361aec65c967d2908f69db4abbe9d3d9b2e (patch)
treed1c77f632321cc7ade7cfbbe7767c31821a6331c /common/src/main/java
parentc786ba6d771200bea0a94be378b191781ffba0f7 (diff)
downloadmoa-id-spss-185aa361aec65c967d2908f69db4abbe9d3d9b2e.tar.gz
moa-id-spss-185aa361aec65c967d2908f69db4abbe9d3d9b2e.tar.bz2
moa-id-spss-185aa361aec65c967d2908f69db4abbe9d3d9b2e.zip
introduced log4j logging system
Diffstat (limited to 'common/src/main/java')
-rw-r--r--common/src/main/java/at/gv/egovernment/moa/logging/Logger.java67
1 files changed, 27 insertions, 40 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 07f9e27af..2e76325a5 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
@@ -24,9 +24,6 @@
package at.gv.egovernment.moa.logging;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* A utility class acting as a facade to the logging subsystem.
*
@@ -39,35 +36,13 @@ import org.apache.commons.logging.LogFactory;
*/
public class Logger {
- /** The default logging hierarchy. */
- private static String defaultHierarchy = "";
-
- /**
- * Get the <code>Log</code> object for the default hierarchy.
- *
- * @return The <code>Log</code> object to write log messages to.
- */
- private static Log getLog() {
- return LogFactory.getLog(defaultHierarchy);
- }
-
- /**
- * Get the <code>Log</code> object for a given hierarchy.
- *
- * @param hierarchy The logging hierarchy for which to return the logger.
- * @return The <code>Log</code> object to write log messages to.
- */
- private static Log getLog(String hierarchy) {
- return LogFactory.getLog(hierarchy);
- }
-
/**
* Set the default hierarchy to which the <code>Logger</code> should send its
* logging output.
* @param hierarchy The logging defaultHierarchy.
*/
public static void setHierarchy(String hierarchy) {
- defaultHierarchy = hierarchy;
+ // there is no need for that anymore
}
/**
@@ -77,7 +52,8 @@ public class Logger {
* <code>false</code> otherwise.
*/
public static boolean isTraceEnabled() {
- return getLog().isTraceEnabled();
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ return logger.isTraceEnabled();
}
/**
@@ -88,7 +64,8 @@ public class Logger {
* <code>false</code> otherwise.
*/
public static boolean isTraceEnabled(String hierarchy) {
- return getLog(hierarchy).isTraceEnabled();
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ return logger.isTraceEnabled();
}
/**
@@ -97,7 +74,8 @@ public class Logger {
* @param message The message to trace.
*/
public static void trace(Object message) {
- getLog().trace(message);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.trace(message);
}
/**
@@ -107,7 +85,8 @@ public class Logger {
* <code>false</code> otherwise.
*/
public static boolean isDebugEnabled() {
- return getLog().isDebugEnabled();
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ return logger.isDebugEnabled();
}
/**
@@ -118,7 +97,8 @@ public class Logger {
* <code>false</code> otherwise.
*/
public static boolean isDebugEnabled(String hierarchy) {
- return getLog(hierarchy).isDebugEnabled();
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ return logger.isDebugEnabled();
}
/**
@@ -127,7 +107,8 @@ public class Logger {
* @param message The message to log.
*/
public static void debug(Object message) {
- getLog().debug(message);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.debug(message);
}
/**
@@ -136,7 +117,8 @@ public class Logger {
* @param message The message to log.
*/
public static void info(Object message) {
- getLog().info(message);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.info(message);
}
/**
@@ -145,7 +127,8 @@ public class Logger {
* @param message The message to log.
*/
public static void warn(Object message) {
- getLog().warn(message);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.warn(message);
}
/**
@@ -155,7 +138,8 @@ public class Logger {
* @param t An exception that may be the cause of the warning.
*/
public static void warn(Object message, Throwable t) {
- getLog().warn(message, t);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.warn(message, t);
}
/**
@@ -164,7 +148,8 @@ public class Logger {
* @param message The message to log.
*/
public static void error(Object message) {
- getLog().error(message);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.error(message);
}
/**
@@ -174,7 +159,8 @@ public class Logger {
* @param t An exception that may be the cause of the error.
*/
public static void error(Object message, Throwable t) {
- getLog().error(message, t);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.error(message, t);
}
/**
@@ -183,7 +169,8 @@ public class Logger {
* @param message The message to log.
*/
public static void fatal(Object message) {
- getLog().fatal(message);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.fatal(message);
}
/**
@@ -193,7 +180,7 @@ public class Logger {
* @param t An exception that may be the cause of the error.
*/
public static void fatal(Object message, Throwable t) {
- getLog().fatal(message, t);
+ org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName());
+ logger.fatal(message, t);
}
-
}