From 4a418d3a55752850891dbb9a6b10d03728a27520 Mon Sep 17 00:00:00 2001 From: lalber Date: Wed, 14 Apr 2021 21:54:08 +0200 Subject: log level via config --- .../core/impl/idp/auth/services/IErrorService.java | 17 ++++-------- .../services/ProtocolAuthenticationService.java | 32 ++-------------------- 2 files changed, 8 insertions(+), 41 deletions(-) (limited to 'eaaf_core/src/main/java/at') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java index 3f4b7f5e..812a5171 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java @@ -4,6 +4,7 @@ import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration; import at.gv.egiz.eaaf.core.exceptions.EaafException; import javax.servlet.http.HttpServletRequest; +import java.util.HashSet; public interface IErrorService { /** @@ -82,18 +83,10 @@ public interface IErrorService { Throwable getThrowable(); /** - * Logs error to technical log. - */ - void log_error(); - - /** - * Logs info to technical log. - */ - void log_info(); - - /** - * Logs warn to technical log. + * Write a Exception to the MOA-ID-Auth internal technical log. + * + * @param logOnInfoLevel set of what to log on info logging lvl */ - void log_warn(); + void logExceptionToTechnicalLog(HashSet logOnInfoLevel); } } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java index be24d586..ffa1163f 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java @@ -247,7 +247,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer // log Error to technical log - logExceptionToTechnicalLog(errorData); + errorData.logExceptionToTechnicalLog(logOnInfoLevel); // log Error Message statisticLogger.logErrorOperation(throwable, protocolRequest); @@ -260,7 +260,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer if (handlingModule.generateErrorMessage(throwable, req, resp, protocolRequest)) { // log Error to technical log - logExceptionToTechnicalLog(errorData); + errorData.logExceptionToTechnicalLog(logOnInfoLevel); // log Error Message statisticLogger.logErrorOperation(throwable, protocolRequest); @@ -321,7 +321,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer } // write errror to console - logExceptionToTechnicalLog(errorData); + errorData.logExceptionToTechnicalLog(logOnInfoLevel); if (errorData.getActionType().equals(IErrorService.ActionType.NOTICKET_NOREDIRECT) || errorData .getActionType().equals(IErrorService.ActionType.TICKET_NOREDIRECT)) { @@ -413,32 +413,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer } - /** - * Write a Exception to the MOA-ID-Auth internal technical log. - * - * @param data errordata structure - */ - protected void logExceptionToTechnicalLog(IErrorService.IHandleData data) { - // In case of a TaskExecutionException, which is only a container for process-errors, - // extract internal exception - - - // Log exception - if (!(data.getThrowable() instanceof EaafException)) { - data.log_error(); - - } else { - - if (logOnInfoLevel.contains(data.getInternalErrorCode())) { - data.log_info(); - - } else { - data.log_warn(); - - } - } - } - @PostConstruct private void initializer() { -- cgit v1.2.3