aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons')
-rw-r--r--id/server/moa-id-commons/pom.xml1
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/logging/Logger.java36
2 files changed, 26 insertions, 11 deletions
diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml
index fd8ddc7fb..31fe6af26 100644
--- a/id/server/moa-id-commons/pom.xml
+++ b/id/server/moa-id-commons/pom.xml
@@ -321,6 +321,7 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/logging/Logger.java
index 9152f2549..197247630 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/logging/Logger.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/logging/Logger.java
@@ -86,12 +86,16 @@ public class Logger {
* <p>Mainly introduce because the <code>message</code> might be <code>null</code>.
*
* @param message the message
+ * @param escape if this flag is true than the message get escapted before logging
* @return the string
*/
- private static String prepareMessage(Object message) {
+ private static String prepareMessage(Object message, boolean escape) {
if(null == message)
return "no message given";
- return StringEscapeUtils.escapeHtml4(message.toString());
+ if (escape)
+ return StringEscapeUtils.escapeHtml4(message.toString());
+ else
+ return message.toString();
}
/**
@@ -124,7 +128,17 @@ public class Logger {
*/
public static void trace(Object message) {
org.slf4j.Logger logger = getLogger();
- logger.trace(prepareMessage(message));
+ logger.trace(prepareMessage(message, true));
+ }
+
+ /**
+ * Trace a message.
+ *
+ * @param message The message to trace.
+ */
+ public static void traceWithOutEscaption(Object message) {
+ org.slf4j.Logger logger = getLogger();
+ logger.trace(prepareMessage(message, false));
}
/**
@@ -157,7 +171,7 @@ public class Logger {
*/
public static void debug(Object message) {
org.slf4j.Logger logger = getLogger();
- logger.debug(prepareMessage(message));
+ logger.debug(prepareMessage(message, true));
}
/**
@@ -167,7 +181,7 @@ public class Logger {
*/
public static void info(Object message) {
org.slf4j.Logger logger = getLogger();
- logger.info(prepareMessage(message));
+ logger.info(prepareMessage(message, true));
}
/**
@@ -178,7 +192,7 @@ public class Logger {
*/
public static void info(String message, Object[] args) {
org.slf4j.Logger logger = getLogger();
- logger.info(prepareMessage(message), args);
+ logger.info(prepareMessage(message, true), args);
}
/**
@@ -188,7 +202,7 @@ public class Logger {
*/
public static void warn(Object message) {
org.slf4j.Logger logger = getLogger();
- logger.warn(prepareMessage(message));
+ logger.warn(prepareMessage(message, true));
}
/**
@@ -199,7 +213,7 @@ public class Logger {
*/
public static void warn(Object message, Throwable t) {
org.slf4j.Logger logger = getLogger();
- logger.warn(prepareMessage(message), t);
+ logger.warn(prepareMessage(message, true), t);
}
/**
@@ -209,7 +223,7 @@ public class Logger {
*/
public static void error(Object message) {
org.slf4j.Logger logger = getLogger();
- logger.error(prepareMessage(message));
+ logger.error(prepareMessage(message, true));
}
/**
@@ -220,7 +234,7 @@ public class Logger {
*/
public static void error(Object message, Throwable t) {
org.slf4j.Logger logger = getLogger();
- logger.error(prepareMessage(message), t);
+ logger.error(prepareMessage(message, true), t);
}
/**
@@ -231,7 +245,7 @@ public class Logger {
*/
public static void error(Object message, Object[] variables) {
org.slf4j.Logger logger = getLogger();
- logger.error(prepareMessage(message), variables);
+ logger.error(prepareMessage(message, true), variables);
}
/**