Also set logging defaults when <Logging> is omitted.
authornlevitt <nlevitt@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 11 Mar 2004 23:57:25 +0000 (23:57 +0000)
committernlevitt <nlevitt@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 11 Mar 2004 23:57:25 +0000 (23:57 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@910 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/log/LoggingContextListener.java

index 1e6ad30..ec6c869 100644 (file)
@@ -130,6 +130,8 @@ public class LoggingContextListener implements ServletContextListener {
        protected void loadConfiguration(Document originConfig) throws ShibbolethConfigurationException
        {
                NodeList itemElements = originConfig.getDocumentElement().getElementsByTagNameNS(ShibbolethOriginConfig.originConfigNamespace, "Logging");
+               Node errorLogNode = null;
+               boolean encounteredLog4JConfig = false;
 
                if (itemElements.getLength() > 1) 
                {
@@ -139,8 +141,6 @@ public class LoggingContextListener implements ServletContextListener {
                if (itemElements.getLength() >= 1) 
                {
                        Node loggingNode = itemElements.item(0);
-                       Node errorLogNode = null;
-                        boolean encounteredLog4JConfig = false;
 
                        for (int i = 0; i < loggingNode.getChildNodes().getLength(); i++)
                        {
@@ -149,7 +149,7 @@ public class LoggingContextListener implements ServletContextListener {
                                if ("Log4JConfig".equals(node.getNodeName()))
                                {
                                        doLog4JConfig(node);
-                                        encounteredLog4JConfig = true;
+                                       encounteredLog4JConfig = true;
                                }
                                else if ("TransactionLog".equals(node.getNodeName()))
                                {
@@ -162,23 +162,23 @@ public class LoggingContextListener implements ServletContextListener {
                                        errorLogNode = node;
                                }
                        }
+               }
 
-                       if (errorLogNode != null)
-                       {
-                               configureErrorLog(errorLogNode);
-                       }
-                       else
-                       {
-                               // started out at INFO for logging config messages
-                               Logger.getRootLogger().setLevel((Level) Level.WARN);
-                       }
+               if (errorLogNode != null)
+               {
+                       configureErrorLog(errorLogNode);
+               }
+               else
+               {
+                       // started out at INFO for logging config messages
+                       Logger.getRootLogger().setLevel((Level) Level.WARN);
+               }
 
-                       // turn these off by default
-                       if (!encounteredLog4JConfig)
-                       {
-                               Logger.getLogger("org.apache.xml.security").setLevel((Level) Level.OFF);
-                               Logger.getLogger("org.opensaml").setLevel((Level) Level.OFF);
-                       }
+               // turn these off by default
+               if (!encounteredLog4JConfig)
+               {
+                       Logger.getLogger("org.apache.xml.security").setLevel((Level) Level.OFF);
+                       Logger.getLogger("org.opensaml").setLevel((Level) Level.OFF);
                }
        }