Improve logging
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 26 Jun 2011 21:40:47 +0000 (21:40 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 26 Jun 2011 21:40:47 +0000 (21:40 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@4612 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/AuthenticatedApplicationContextInitialization.java
security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/AuthenticationProvidersRegister.java
server/runtime/org.argeo.server.webextender/src/main/java/org/argeo/server/webextender/TomcatDeployer.java

index 51d4b192966dccb77d6ba214f202fc1b95dc2397..59f6a517921e79c448e08ad342889e6c2fb5497e 100644 (file)
@@ -29,8 +29,8 @@ public class AuthenticatedApplicationContextInitialization extends
                // refreshed in order to be able to deal with factory beans has well
                if (!isAuthenticatedBySelf()) {
                        authenticateAsSystem();
-                       if (log.isDebugEnabled())
-                               log.debug("Application context initialization authenticated for thread "
+                       if (log.isTraceEnabled())
+                               log.trace("Application context initialization authenticated for thread "
                                                + Thread.currentThread().getName());
                }
                return null;
@@ -68,8 +68,8 @@ public class AuthenticatedApplicationContextInitialization extends
                        // make sure that we have deauthenticated after the application
                        // context was initialized/refreshed
                        deauthenticateAsSystem();
-                       if (log.isDebugEnabled())
-                               log.debug("Application context initialization deauthenticated for thread "
+                       if (log.isTraceEnabled())
+                               log.trace("Application context initialization deauthenticated for thread "
                                                + Thread.currentThread().getName());
                }
        }
index bd14659c82cd1d8ac405316273b1eee0806f1c89..d60c65e532b8ca2ed596d8aba40aef3f3db9fbb3 100644 (file)
@@ -21,15 +21,15 @@ public class AuthenticationProvidersRegister implements InitializingBean {
        public void register(Object authenticationProvider,
                        Map<String, String> parameters) {
                providers.add(authenticationProvider);
-               if (log.isDebugEnabled())
-                       log.debug("Registered authentication provider " + parameters);
+               if (log.isTraceEnabled())
+                       log.trace("Registered authentication provider " + parameters);
        }
 
        public void unregister(Object authenticationProvider,
                        Map<String, String> parameters) {
                providers.remove(authenticationProvider);
-               if (log.isDebugEnabled())
-                       log.debug("Unregistered authentication provider " + parameters);
+               if (log.isTraceEnabled())
+                       log.trace("Unregistered authentication provider " + parameters);
        }
 
        public List<Object> getProviders() {
index c41351dc0083440165d534fb75e2ab2431f9db53..27b0670321327d088bae888afde802bb01d759c0 100644 (file)
@@ -15,6 +15,7 @@ import org.springframework.util.ObjectUtils;
 public class TomcatDeployer extends TomcatWarDeployer {
        private String serverInfo;
        private Service service;
+       private String contextPath = "/org.argeo.rap.webapp";
 
        @Override
        public void setService(Object service) {
@@ -23,8 +24,8 @@ public class TomcatDeployer extends TomcatWarDeployer {
                // TODO: listen to OSGi service so that we get notified in the
                // (unlikely) case the underlying service is updated
                serverInfo = ((Service) service).getInfo();
-               if (log.isDebugEnabled())
-                       log.debug("Argeo modified Tomcat deployer used");
+               if (log.isTraceEnabled())
+                       log.trace("Argeo modified Tomcat deployer used");
        }
 
        @Override
@@ -42,8 +43,7 @@ public class TomcatDeployer extends TomcatWarDeployer {
                // Required for multiple RAP sessions to work with Tomcat
                // see
                // http://wiki.eclipse.org/RAP/FAQ#How_to_run_a_RAP_application_in_multiple_browser_tabs.2Fwindows.3F
-               // TODO make it configurable in order to cover other web apps
-               Context context = getContext("/org.argeo.rap.webapp");
+               Context context = getContext(contextPath);
                if (context != null)
                        context.setCookies(false);
        }
@@ -51,7 +51,8 @@ public class TomcatDeployer extends TomcatWarDeployer {
        /** @return null if not found */
        private Context getContext(String path) {
                for (Container container : getHost().findChildren()) {
-                       log.debug(container.getClass() + ": " + container.getName());
+                       if (log.isTraceEnabled())
+                               log.trace(container.getClass() + ": " + container.getName());
                        if (container instanceof Context) {
                                Context context = (Context) container;
                                if (path.equals(context.getPath()))
@@ -78,4 +79,8 @@ public class TomcatDeployer extends TomcatWarDeployer {
                return children[0];
        }
 
+       public void setContextPath(String contextPath) {
+               this.contextPath = contextPath;
+       }
+
 }