diff options
11 files changed, 27 insertions, 57 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); } - } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java index 31114a319..1d9e31674 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java @@ -99,7 +99,6 @@ public class AttributeCollector implements IAction { * @throws MOAIDException */ public String processRequest(DataContainer container, HttpServletRequest request, HttpServletResponse response, AuthenticationSession moasession, OAAuthParameter oaParam) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); // check if there are attributes we need to fetch IPersonalAttributeList requestAttributeList = container.getRequest().getPersonalAttributeList(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java index 7fb7a7bc6..a339cff23 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java @@ -60,7 +60,6 @@ public class AttributeProviderFactory { */ public static List<AttributeProvider> getConfiguredPlugins( List<AttributeProviderPlugin> configuredAPs) { - Logger.setHierarchy("moa.id.protocols.stork2"); List<AttributeProvider> result = new ArrayList<AttributeProvider>(); for (AttributeProviderPlugin current : configuredAPs) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java index 88c0e889d..5e49fe413 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java @@ -39,7 +39,6 @@ public class AuthenticationRequest implements IAction { public String processRequest(IRequest req, HttpServletRequest httpReq, HttpServletResponse httpResp, AuthenticationSession moasession) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); this.moaSession = moasession; if (req instanceof MOASTORKRequest) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java index f7d105ab8..a257474e3 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java @@ -71,7 +71,6 @@ public class EHvdAttributeProviderPlugin implements AttributeProvider { throw new UnsupportedAttributeException(); try { - Logger.setHierarchy("moa.id.protocols.stork2"); Logger.debug("initializing SOAP connections..."); // create SOAP connection SOAPConnection soapConnection = SOAPConnectionFactory.newInstance().createConnection(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java index 44b140548..873ec1e26 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java @@ -43,7 +43,6 @@ public class MOAAttributeProvider { public void populateAttribute(PersonalAttributeList attributeList, PersonalAttribute requestedAttribute ) { String storkAttribute = requestedAttribute.getName(); - Logger.setHierarchy("moa.id.protocols.stork2"); if (storkAttributeSimpleMapping.containsKey(storkAttribute)) { Logger.debug("Trying to get value for attribute using simple mapping [" + storkAttribute + "]"); try { @@ -70,7 +69,6 @@ public class MOAAttributeProvider { } private String geteIdentifier() { - Logger.setHierarchy("moa.id.protocols.stork2"); Logger.debug("Using base urn for identification value: " + identityLink.getIdentificationType() + " and target country: " + moastorkRequest.getStorkAuthnRequest().getSpCountry()); try { return new BPKBuilder().buildStorkbPK(identityLink.getIdentificationValue(), moastorkRequest.getStorkAuthnRequest().getSpCountry()); @@ -82,7 +80,6 @@ public class MOAAttributeProvider { private void populateAttributeWithMethod(Method method, Object object, PersonalAttributeList attributeList, String storkAttribute, Boolean isRequired) { - Logger.setHierarchy("moa.id.protocols.stork2"); try { String attributeValue = method.invoke(object, new Class[]{}).toString(); PersonalAttribute newAttribute = new PersonalAttribute(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java index e691f87e1..0e94600db 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java @@ -37,7 +37,6 @@ public class MandateAttributeRequestProvider implements AttributeProvider { private PersonalAttributeList requestedAttributes; public MandateAttributeRequestProvider(String aPurl, String supportedAttributes) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); destination = aPurl; attributes = supportedAttributes; } @@ -64,7 +63,6 @@ public class MandateAttributeRequestProvider implements AttributeProvider { } public void performRedirect(String url, HttpServletRequest req, HttpServletResponse resp, OAAuthParameter oaParam) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); String spSector = "Business"; String spInstitution = StringUtils.isEmpty(oaParam.getFriendlyName()) ? "UNKNOWN" : oaParam.getFriendlyName(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java index 4e99cc8aa..3bd1686b4 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java @@ -14,7 +14,6 @@ import javax.servlet.http.HttpServletResponse; */ public class MandateRetrievalRequest implements IAction { public String processRequest(IRequest req, HttpServletRequest httpReq, HttpServletResponse httpResp, AuthenticationSession moasession) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); Logger.info("Entering mandateretrievalrequest"); return null; // } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java index ec77109af..5b844580d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java @@ -58,7 +58,6 @@ public class STORKProtocol implements IModulInfo, MOAIDAuthConstants { and other info are obtained, in the second step the request will be processed and the user redirected */ public IRequest preProcess(HttpServletRequest request, HttpServletResponse response, String action) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); Logger.info("Starting preprocessing for Stork2 protocol"); Logger.debug("Request method: " + request.getMethod()); Logger.debug("Request content length: " + request.getContentLength()); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java index 01297c963..89eb07815 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java @@ -75,7 +75,6 @@ public class SignedDocAttributeRequestProvider implements AttributeProvider { * .servlet.http.HttpServletRequest) */ public IPersonalAttributeList parse(HttpServletRequest httpReq) throws MOAIDException, UnsupportedAttributeException { - Logger.setHierarchy("moa.id.protocols.stork2"); Logger.debug("Beginning to extract OASIS-DSS response out of HTTP Request"); try { @@ -107,8 +106,6 @@ public class SignedDocAttributeRequestProvider implements AttributeProvider { public void performRedirect(String url, HttpServletRequest req, HttpServletResponse resp, OAAuthParameter oaParam) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); - try { Logger.trace("Initialize VelocityEngine..."); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java index 449fef1cb..c0e613b82 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java @@ -73,7 +73,6 @@ public class StorkAttributeRequestProvider implements AttributeProvider { */ public IPersonalAttributeList parse(HttpServletRequest httpReq) throws MOAIDException, UnsupportedAttributeException { - Logger.setHierarchy("moa.id.protocols.stork2"); Logger.info(this.getClass().getSimpleName() + " tries to extract SAMLResponse out of HTTP Request"); //extract STORK Response from HTTP Request @@ -107,8 +106,6 @@ public class StorkAttributeRequestProvider implements AttributeProvider { */ public void performRedirect(String url, HttpServletRequest req, HttpServletResponse resp, OAAuthParameter oaParam) throws MOAIDException { - Logger.setHierarchy("moa.id.protocols.stork2"); - String spSector = "Business"; String spInstitution = StringUtils.isEmpty(oaParam.getFriendlyName()) ? "UNKNOWN" : oaParam.getFriendlyName(); String spApplication = spInstitution; |