From b4c009b6d64cc17974e5917c10f92dbe987d826e Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 12 Mar 2018 13:35:46 +0100 Subject: add specific AuthBlock validation logging --- .../java/at/gv/egovernment/moa/logging/Logger.java | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'id/server/moa-id-commons/src/main/java') 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 { *

Mainly introduce because the message might be null. * * @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); } /** -- cgit v1.2.3