This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new ec96773985 Differentiate trace and debug log levels
ec96773985 is described below

commit ec96773985a374d320cf75679fd5a753e25e12b7
Author: remm <r...@apache.org>
AuthorDate: Fri Feb 2 22:14:39 2024 +0100

    Differentiate trace and debug log levels
---
 java/org/apache/catalina/mapper/Mapper.java        |   4 +-
 .../mbeans/GlobalResourcesLifecycleListener.java   |  26 ++---
 java/org/apache/catalina/realm/CombinedRealm.java  |  74 ++++++-------
 .../catalina/realm/JAASMemoryLoginModule.java      |  16 +--
 java/org/apache/catalina/realm/JAASRealm.java      |  34 +++---
 java/org/apache/catalina/realm/JNDIRealm.java      |  32 +++---
 java/org/apache/catalina/realm/MemoryRealm.java    |   4 +-
 java/org/apache/catalina/realm/RealmBase.java      | 114 ++++++++++-----------
 8 files changed, 154 insertions(+), 150 deletions(-)

diff --git a/java/org/apache/catalina/mapper/Mapper.java 
b/java/org/apache/catalina/mapper/Mapper.java
index 40c214fd87..c07c6c12ff 100644
--- a/java/org/apache/catalina/mapper/Mapper.java
+++ b/java/org/apache/catalina/mapper/Mapper.java
@@ -520,8 +520,8 @@ public final class Mapper {
 
     protected void removeWrapper(ContextVersion context, String path) {
 
-        if (log.isDebugEnabled()) {
-            log.debug(sm.getString("mapper.removeWrapper", context.name, 
path));
+        if (log.isTraceEnabled()) {
+            log.trace(sm.getString("mapper.removeWrapper", context.name, 
path));
         }
 
         synchronized (context) {
diff --git 
a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java 
b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
index c688b6e515..feba89cf8e 100644
--- a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
+++ b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
@@ -130,8 +130,8 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
                 Binding binding = bindings.next();
                 String name = prefix + binding.getName();
                 Object value = context.lookup(binding.getName());
-                if (log.isDebugEnabled()) {
-                    log.debug("Checking resource " + name);
+                if (log.isTraceEnabled()) {
+                    log.trace("Checking resource " + name);
                 }
                 if (value instanceof Context) {
                     createMBeans(name + "/", (Context) value);
@@ -162,9 +162,9 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
     protected void createMBeans(String name, UserDatabase database) throws 
Exception {
 
         // Create the MBean for the UserDatabase itself
-        if (log.isDebugEnabled()) {
-            log.debug("Creating UserDatabase MBeans for resource " + name);
-            log.debug("Database=" + database);
+        if (log.isTraceEnabled()) {
+            log.trace("Creating UserDatabase MBeans for resource " + name);
+            log.trace("Database=" + database);
         }
         try {
             MBeanUtils.createMBean(database);
@@ -181,8 +181,8 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
         Iterator<Role> roles = database.getRoles();
         while (roles.hasNext()) {
             Role role = roles.next();
-            if (log.isDebugEnabled()) {
-                log.debug("  Creating Role MBean for role " + role);
+            if (log.isTraceEnabled()) {
+                log.trace("  Creating Role MBean for role " + role);
             }
             try {
                 MBeanUtils.createMBean(role);
@@ -196,8 +196,8 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
         Iterator<Group> groups = database.getGroups();
         while (groups.hasNext()) {
             Group group = groups.next();
-            if (log.isDebugEnabled()) {
-                log.debug("  Creating Group MBean for group " + group);
+            if (log.isTraceEnabled()) {
+                log.trace("  Creating Group MBean for group " + group);
             }
             try {
                 MBeanUtils.createMBean(group);
@@ -211,8 +211,8 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
         Iterator<User> users = database.getUsers();
         while (users.hasNext()) {
             User user = users.next();
-            if (log.isDebugEnabled()) {
-                log.debug("  Creating User MBean for user " + user);
+            if (log.isTraceEnabled()) {
+                log.trace("  Creating User MBean for user " + user);
             }
             try {
                 MBeanUtils.createMBean(user);
@@ -228,8 +228,8 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
      * Destroy the MBeans for the interesting global JNDI resources.
      */
     protected void destroyMBeans() {
-        if (log.isDebugEnabled()) {
-            log.debug("Destroying MBeans for Global JNDI Resources");
+        if (log.isTraceEnabled()) {
+            log.trace("Destroying MBeans for Global JNDI Resources");
         }
     }
 }
diff --git a/java/org/apache/catalina/realm/CombinedRealm.java 
b/java/org/apache/catalina/realm/CombinedRealm.java
index ffb3ff22cd..0a97c340f2 100644
--- a/java/org/apache/catalina/realm/CombinedRealm.java
+++ b/java/org/apache/catalina/realm/CombinedRealm.java
@@ -60,7 +60,7 @@ public class CombinedRealm extends RealmBase {
         realms.add(theRealm);
 
         if (log.isDebugEnabled()) {
-            sm.getString("combinedRealm.addRealm", 
theRealm.getClass().getName(), Integer.toString(realms.size()));
+            log.debug(sm.getString("combinedRealm.addRealm", 
theRealm.getClass().getName(), Integer.toString(realms.size())));
         }
     }
 
@@ -93,20 +93,20 @@ public class CombinedRealm extends RealmBase {
         Principal authenticatedUser = null;
 
         for (Realm realm : realms) {
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
             }
 
             authenticatedUser =
                     realm.authenticate(username, clientDigest, nonce, nc, 
cnonce, qop, realmName, digestA2, algorithm);
 
             if (authenticatedUser == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
                 }
             } else {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
                 }
                 break;
             }
@@ -120,19 +120,19 @@ public class CombinedRealm extends RealmBase {
         Principal authenticatedUser = null;
 
         for (Realm realm : realms) {
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
             }
 
             authenticatedUser = realm.authenticate(username);
 
             if (authenticatedUser == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
                 }
             } else {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
                 }
                 break;
             }
@@ -146,19 +146,19 @@ public class CombinedRealm extends RealmBase {
         Principal authenticatedUser = null;
 
         for (Realm realm : realms) {
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
             }
 
             authenticatedUser = realm.authenticate(username, credentials);
 
             if (authenticatedUser == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
                 }
             } else {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
                 }
                 break;
             }
@@ -257,19 +257,19 @@ public class CombinedRealm extends RealmBase {
         }
 
         for (Realm realm : realms) {
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("combinedRealm.authStart", username, 
realm.getClass().getName()));
             }
 
             authenticatedUser = realm.authenticate(certs);
 
             if (authenticatedUser == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authFail", username, 
realm.getClass().getName()));
                 }
             } else {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authSuccess", 
username, realm.getClass().getName()));
                 }
                 break;
             }
@@ -291,19 +291,19 @@ public class CombinedRealm extends RealmBase {
             }
 
             for (Realm realm : realms) {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authStart", gssName, 
realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authStart", gssName, 
realm.getClass().getName()));
                 }
 
                 authenticatedUser = realm.authenticate(gssContext, storeCred);
 
                 if (authenticatedUser == null) {
-                    if (log.isDebugEnabled()) {
-                        log.debug(sm.getString("combinedRealm.authFail", 
gssName, realm.getClass().getName()));
+                    if (log.isTraceEnabled()) {
+                        log.trace(sm.getString("combinedRealm.authFail", 
gssName, realm.getClass().getName()));
                     }
                 } else {
-                    if (log.isDebugEnabled()) {
-                        log.debug(sm.getString("combinedRealm.authSuccess", 
gssName, realm.getClass().getName()));
+                    if (log.isTraceEnabled()) {
+                        log.trace(sm.getString("combinedRealm.authSuccess", 
gssName, realm.getClass().getName()));
                     }
                     break;
                 }
@@ -321,19 +321,19 @@ public class CombinedRealm extends RealmBase {
         Principal authenticatedUser = null;
 
         for (Realm realm : realms) {
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("combinedRealm.authStart", gssName, 
realm.getClass().getName()));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("combinedRealm.authStart", gssName, 
realm.getClass().getName()));
             }
 
             authenticatedUser = realm.authenticate(gssName, gssCredential);
 
             if (authenticatedUser == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authFail", gssName, 
realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authFail", gssName, 
realm.getClass().getName()));
                 }
             } else {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("combinedRealm.authSuccess", 
gssName, realm.getClass().getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("combinedRealm.authSuccess", 
gssName, realm.getClass().getName()));
                 }
                 break;
             }
diff --git a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java 
b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
index d4e3b0959b..1cd386a420 100644
--- a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
+++ b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
@@ -122,8 +122,8 @@ public class JAASMemoryLoginModule extends MemoryRealm 
implements LoginModule {
     // --------------------------------------------------------- Public Methods
 
     public JAASMemoryLoginModule() {
-        if (log.isDebugEnabled()) {
-            log.debug("MEMORY LOGIN MODULE");
+        if (log.isTraceEnabled()) {
+            log.trace("MEMORY LOGIN MODULE");
         }
     }
 
@@ -143,8 +143,8 @@ public class JAASMemoryLoginModule extends MemoryRealm 
implements LoginModule {
             committed = false;
             principal = null;
         }
-        if (log.isDebugEnabled()) {
-            log.debug("Abort");
+        if (log.isTraceEnabled()) {
+            log.trace("Abort");
         }
         return true;
     }
@@ -152,8 +152,8 @@ public class JAASMemoryLoginModule extends MemoryRealm 
implements LoginModule {
 
     @Override
     public boolean commit() throws LoginException {
-        if (log.isDebugEnabled()) {
-            log.debug("commit " + principal);
+        if (log.isTraceEnabled()) {
+            log.trace("commit " + principal);
         }
 
         // If authentication was not successful, just return false
@@ -183,8 +183,8 @@ public class JAASMemoryLoginModule extends MemoryRealm 
implements LoginModule {
     @Override
     public void initialize(Subject subject, CallbackHandler callbackHandler, 
Map<String,?> sharedState,
             Map<String,?> options) {
-        if (log.isDebugEnabled()) {
-            log.debug("Init");
+        if (log.isTraceEnabled()) {
+            log.trace("Init");
         }
 
         // Save configuration values
diff --git a/java/org/apache/catalina/realm/JAASRealm.java 
b/java/org/apache/catalina/realm/JAASRealm.java
index cac685c00d..cc80eb7c14 100644
--- a/java/org/apache/catalina/realm/JAASRealm.java
+++ b/java/org/apache/catalina/realm/JAASRealm.java
@@ -341,8 +341,8 @@ public class JAASRealm extends RealmBase {
                 appName = "Tomcat";
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jaasRealm.beginLogin", username, 
appName));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("jaasRealm.beginLogin", username, 
appName));
             }
 
             // What if the LoginModule is in the container class loader ?
@@ -371,8 +371,8 @@ public class JAASRealm extends RealmBase {
                 }
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug("Login context created " + username);
+            if (log.isTraceEnabled()) {
+                log.trace("Login context created " + username);
             }
 
             // Negotiate a login via this LoginContext
@@ -430,23 +430,25 @@ public class JAASRealm extends RealmBase {
                 return null;
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jaasRealm.loginContextCreated", 
username));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("jaasRealm.loginContextCreated", 
username));
             }
 
             // Return the appropriate Principal for this authenticated Subject
             Principal principal = createPrincipal(username, subject, 
loginContext);
             if (principal == null) {
-                log.debug(sm.getString("jaasRealm.authenticateFailure", 
username));
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("jaasRealm.authenticateFailure", 
username));
+                }
                 return null;
             }
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jaasRealm.authenticateSuccess", 
username, principal));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("jaasRealm.authenticateSuccess", 
username, principal));
             }
 
             return principal;
         } catch (Throwable t) {
-            log.error("error ", t);
+            log.error(sm.getString("jaasRealm.unexpectedError"), t);
             // JAAS throws exception different than LoginException so mark the 
realm as unavailable
             invocationSuccess = false;
             return null;
@@ -500,21 +502,21 @@ public class JAASRealm extends RealmBase {
         for (Principal principal : subject.getPrincipals()) {
             String principalClass = principal.getClass().getName();
 
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jaasRealm.checkPrincipal", principal, 
principalClass));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("jaasRealm.checkPrincipal", principal, 
principalClass));
             }
 
             if (userPrincipal == null && userClasses.contains(principalClass)) 
{
                 userPrincipal = principal;
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("jaasRealm.userPrincipalSuccess", 
principal.getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("jaasRealm.userPrincipalSuccess", 
principal.getName()));
                 }
             }
 
             if (roleClasses.contains(principalClass)) {
                 roles.add(principal.getName());
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("jaasRealm.rolePrincipalAdd", 
principal.getName()));
+                if (log.isTraceEnabled()) {
+                    log.trace(sm.getString("jaasRealm.rolePrincipalAdd", 
principal.getName()));
                 }
             }
         }
diff --git a/java/org/apache/catalina/realm/JNDIRealm.java 
b/java/org/apache/catalina/realm/JNDIRealm.java
index 8f26b976b9..da92dffff2 100644
--- a/java/org/apache/catalina/realm/JNDIRealm.java
+++ b/java/org/apache/catalina/realm/JNDIRealm.java
@@ -967,7 +967,9 @@ public class JNDIRealm extends RealmBase {
             this.cipherSuitesArray = null;
         } else {
             this.cipherSuitesArray = cipherSuites.trim().split("\\s*,\\s*");
-            containerLog.debug(sm.getString("jndiRealm.cipherSuites", 
Arrays.toString(this.cipherSuitesArray)));
+            if (containerLog.isTraceEnabled()) {
+                containerLog.trace(sm.getString("jndiRealm.cipherSuites", 
Arrays.toString(this.cipherSuitesArray)));
+            }
         }
         return this.cipherSuitesArray;
     }
@@ -1256,8 +1258,8 @@ public class JNDIRealm extends RealmBase {
                             if (checkCredentials(connection.context, user, 
credentials)) {
                                 // Search for additional roles
                                 List<String> roles = getRoles(connection, 
user);
-                                if (containerLog.isDebugEnabled()) {
-                                    containerLog.debug("Found roles: " + 
((roles == null) ? "" : roles.toString()));
+                                if (containerLog.isTraceEnabled()) {
+                                    containerLog.trace("Found roles: " + 
((roles == null) ? "" : roles.toString()));
                                 }
                                 return new GenericPrincipal(username, roles);
                             }
@@ -1286,8 +1288,8 @@ public class JNDIRealm extends RealmBase {
 
                 // Search for additional roles
                 List<String> roles = getRoles(connection, user);
-                if (containerLog.isDebugEnabled()) {
-                    containerLog.debug("Found roles: " + ((roles == null) ? "" 
: roles.toString()));
+                if (containerLog.isTraceEnabled()) {
+                    containerLog.trace("Found roles: " + ((roles == null) ? "" 
: roles.toString()));
                 }
 
                 // Create and return a suitable Principal for this user
@@ -1498,8 +1500,8 @@ public class JNDIRealm extends RealmBase {
         // Use pattern or search for user entry
         if (userPatternArray != null && curUserPattern >= 0) {
             user = getUserByPattern(connection, username, credentials, 
attrIds, curUserPattern);
-            if (containerLog.isDebugEnabled()) {
-                containerLog.debug("Found user by pattern [" + user + "]");
+            if (containerLog.isTraceEnabled()) {
+                containerLog.trace("Found user by pattern [" + user + "]");
             }
         } else {
             boolean thisUserSearchAsUser = isUserSearchAsUser();
@@ -1513,8 +1515,8 @@ public class JNDIRealm extends RealmBase {
                     userCredentialsRemove(connection.context);
                 }
             }
-            if (containerLog.isDebugEnabled()) {
-                containerLog.debug("Found user by search [" + user + "]");
+            if (containerLog.isTraceEnabled()) {
+                containerLog.trace("Found user by search [" + user + "]");
             }
         }
         if (userPassword == null && credentials != null && user != null) {
@@ -2219,8 +2221,8 @@ public class JNDIRealm extends RealmBase {
         }
         // Close our opened connection
         try {
-            if (containerLog.isDebugEnabled()) {
-                containerLog.debug("Closing directory context");
+            if (containerLog.isTraceEnabled()) {
+                containerLog.trace("Closing directory context");
             }
             connection.context.close();
         } catch (NamingException e) {
@@ -2658,10 +2660,10 @@ public class JNDIRealm extends RealmBase {
         Hashtable<String,String> env = new Hashtable<>();
 
         // Configure our directory context environment.
-        if (containerLog.isDebugEnabled() && connectionAttempt == 0) {
-            containerLog.debug("Connecting to URL " + connectionURL);
-        } else if (containerLog.isDebugEnabled() && connectionAttempt > 0) {
-            containerLog.debug("Connecting to URL " + alternateURL);
+        if (containerLog.isTraceEnabled() && connectionAttempt == 0) {
+            containerLog.trace("Connecting to URL " + connectionURL);
+        } else if (containerLog.isTraceEnabled() && connectionAttempt > 0) {
+            containerLog.trace("Connecting to URL " + alternateURL);
         }
         env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
         if (connectionName != null) {
diff --git a/java/org/apache/catalina/realm/MemoryRealm.java 
b/java/org/apache/catalina/realm/MemoryRealm.java
index 317af24712..cf9f15592a 100644
--- a/java/org/apache/catalina/realm/MemoryRealm.java
+++ b/java/org/apache/catalina/realm/MemoryRealm.java
@@ -223,8 +223,8 @@ public class MemoryRealm extends RealmBase {
         String pathName = getPathname();
         try (InputStream is = 
ConfigFileLoader.getSource().getResource(pathName).getInputStream()) {
             // Load the contents of the database file
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("memoryRealm.loadPath", pathName));
+            if (log.isTraceEnabled()) {
+                log.trace(sm.getString("memoryRealm.loadPath", pathName));
             }
 
             synchronized (digesterLock) {
diff --git a/java/org/apache/catalina/realm/RealmBase.java 
b/java/org/apache/catalina/realm/RealmBase.java
index 8baadec883..ce8f398698 100644
--- a/java/org/apache/catalina/realm/RealmBase.java
+++ b/java/org/apache/catalina/realm/RealmBase.java
@@ -409,8 +409,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
 
         String serverDigest = 
HexUtils.toHexString(ConcurrentMessageDigest.digest(algorithm, valueBytes));
 
-        if (log.isDebugEnabled()) {
-            log.debug("Digest : " + clientDigest + " Username:" + username + " 
ClientDigest:" + clientDigest +
+        if (log.isTraceEnabled()) {
+            log.trace("Digest : " + clientDigest + " Username:" + username + " 
ClientDigest:" + clientDigest +
                     " nonce:" + nonce + " nc:" + nc + " cnonce:" + cnonce + " 
qop:" + qop + " realm:" + realm +
                     "digestA2:" + digestA2 + " Server digest:" + serverDigest);
         }
@@ -431,13 +431,13 @@ public abstract class RealmBase extends 
LifecycleMBeanBase implements Realm {
         }
 
         // Check the validity of each certificate in the chain
-        if (log.isDebugEnabled()) {
-            log.debug("Authenticating client certificate chain");
+        if (log.isTraceEnabled()) {
+            log.trace("Authenticating client certificate chain");
         }
         if (validate) {
             for (X509Certificate cert : certs) {
-                if (log.isDebugEnabled()) {
-                    log.debug(" Checking validity for '" + 
cert.getSubjectX500Principal().toString() + "'");
+                if (log.isTraceEnabled()) {
+                    log.trace(" Checking validity for '" + 
cert.getSubjectX500Principal().toString() + "'");
                 }
                 try {
                     cert.checkValidity();
@@ -475,8 +475,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
                             
log.warn(sm.getString("realmBase.delegatedCredentialFail", gssName), e);
                         }
                     } else {
-                        if (log.isDebugEnabled()) {
-                            
log.debug(sm.getString("realmBase.credentialNotDelegated", gssName));
+                        if (log.isTraceEnabled()) {
+                            
log.trace(sm.getString("realmBase.credentialNotDelegated", gssName));
                         }
                     }
                 }
@@ -520,8 +520,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
         // Are there any defined security constraints?
         SecurityConstraint constraints[] = context.findConstraints();
         if (constraints == null || constraints.length == 0) {
-            if (log.isDebugEnabled()) {
-                log.debug("  No applicable constraints defined");
+            if (log.isTraceEnabled()) {
+                log.trace("  No applicable constraints defined");
             }
             return null;
         }
@@ -546,8 +546,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
                 continue;
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
+            if (log.isTraceEnabled()) {
+                log.trace("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
                         constraints[i].included(uri, method));
             }
 
@@ -590,8 +590,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
                 continue;
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
+            if (log.isTraceEnabled()) {
+                log.trace("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
                         constraints[i].included(uri, method));
             }
 
@@ -652,8 +652,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
                 continue;
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
+            if (log.isTraceEnabled()) {
+                log.trace("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
                         constraints[i].included(uri, method));
             }
 
@@ -707,8 +707,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
                 continue;
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
+            if (log.isTraceEnabled()) {
+                log.trace("  Checking constraint '" + constraints[i] + "' 
against " + method + " " + uri + " --> " +
                         constraints[i].included(uri, method));
             }
 
@@ -739,8 +739,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
 
         if (results == null) {
             // No applicable security constraint was found
-            if (log.isDebugEnabled()) {
-                log.debug("  No applicable constraint located");
+            if (log.isTraceEnabled()) {
+                log.trace("  No applicable constraint located");
             }
         }
         return resultsToArray(results);
@@ -782,50 +782,50 @@ public abstract class RealmBase extends 
LifecycleMBeanBase implements Realm {
                 roles = new String[0];
             }
 
-            if (log.isDebugEnabled()) {
-                log.debug("  Checking roles " + principal);
+            if (log.isTraceEnabled()) {
+                log.trace("  Checking roles " + principal);
             }
 
             if (constraint.getAuthenticatedUsers() && principal != null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Passing all authenticated users");
+                if (log.isTraceEnabled()) {
+                    log.trace("Passing all authenticated users");
                 }
                 status = true;
             } else if (roles.length == 0 && !constraint.getAllRoles() && 
!constraint.getAuthenticatedUsers()) {
                 if (constraint.getAuthConstraint()) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("No roles");
+                    if (log.isTraceEnabled()) {
+                        log.trace("No roles");
                     }
                     status = false; // No listed roles means no access at all
                     denyfromall = true;
                     break;
                 }
 
-                if (log.isDebugEnabled()) {
-                    log.debug("Passing all access");
+                if (log.isTraceEnabled()) {
+                    log.trace("Passing all access");
                 }
                 status = true;
             } else if (principal == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("  No user authenticated, cannot grant access");
+                if (log.isTraceEnabled()) {
+                    log.trace("  No user authenticated, cannot grant access");
                 }
             } else {
                 for (String role : roles) {
                     if (hasRole(request.getWrapper(), principal, role)) {
                         status = true;
-                        if (log.isDebugEnabled()) {
-                            log.debug("Role found:  " + role);
+                        if (log.isTraceEnabled()) {
+                            log.trace("Role found:  " + role);
                         }
-                    } else if (log.isDebugEnabled()) {
-                        log.debug("No role found:  " + role);
+                    } else if (log.isTraceEnabled()) {
+                        log.trace("No role found:  " + role);
                     }
                 }
             }
         }
 
         if (!denyfromall && allRolesMode != AllRolesMode.STRICT_MODE && 
!status && principal != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("Checking for all roles mode: " + allRolesMode);
+            if (log.isTraceEnabled()) {
+                log.trace("Checking for all roles mode: " + allRolesMode);
             }
             // Check for an all roles(role-name="*")
             for (SecurityConstraint constraint : constraints) {
@@ -833,8 +833,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
                 // If the all roles mode exists, sets
                 if (constraint.getAllRoles()) {
                     if (allRolesMode == AllRolesMode.AUTH_ONLY_MODE) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("Granting access for role-name=*, 
auth-only");
+                        if (log.isTraceEnabled()) {
+                            log.trace("Granting access for role-name=*, 
auth-only");
                         }
                         status = true;
                         break;
@@ -846,8 +846,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
                         roles = new String[0];
                     }
                     if (roles.length == 0 && allRolesMode == 
AllRolesMode.STRICT_AUTH_ONLY_MODE) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("Granting access for role-name=*, strict 
auth-only");
+                        if (log.isTraceEnabled()) {
+                            log.trace("Granting access for role-name=*, strict 
auth-only");
                         }
                         status = true;
                         break;
@@ -889,12 +889,12 @@ public abstract class RealmBase extends 
LifecycleMBeanBase implements Realm {
 
         boolean result = hasRoleInternal(principal, role);
 
-        if (log.isDebugEnabled()) {
+        if (log.isTraceEnabled()) {
             String name = principal.getName();
             if (result) {
-                log.debug(sm.getString("realmBase.hasRoleSuccess", name, 
role));
+                log.trace(sm.getString("realmBase.hasRoleSuccess", name, 
role));
             } else {
-                log.debug(sm.getString("realmBase.hasRoleFailure", name, 
role));
+                log.trace(sm.getString("realmBase.hasRoleFailure", name, 
role));
             }
         }
 
@@ -964,22 +964,22 @@ public abstract class RealmBase extends 
LifecycleMBeanBase implements Realm {
 
         // Is there a relevant user data constraint?
         if (constraints == null || constraints.length == 0) {
-            if (log.isDebugEnabled()) {
-                log.debug("  No applicable security constraint defined");
+            if (log.isTraceEnabled()) {
+                log.trace("  No applicable security constraint defined");
             }
             return true;
         }
         for (SecurityConstraint constraint : constraints) {
             String userConstraint = constraint.getUserConstraint();
             if (userConstraint == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("  No applicable user data constraint defined");
+                if (log.isTraceEnabled()) {
+                    log.trace("  No applicable user data constraint defined");
                 }
                 return true;
             }
             if (userConstraint.equals(TransportGuarantee.NONE.name())) {
-                if (log.isDebugEnabled()) {
-                    log.debug("  User data constraint has no restrictions");
+                if (log.isTraceEnabled()) {
+                    log.trace("  User data constraint has no restrictions");
                 }
                 return true;
             }
@@ -987,8 +987,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
         }
         // Validate the request against the user data constraint
         if (request.getRequest().isSecure()) {
-            if (log.isDebugEnabled()) {
-                log.debug("  User data constraint already satisfied");
+            if (log.isTraceEnabled()) {
+                log.trace("  User data constraint already satisfied");
             }
             return true;
         }
@@ -997,8 +997,8 @@ public abstract class RealmBase extends LifecycleMBeanBase 
implements Realm {
 
         // Is redirecting disabled?
         if (redirectPort <= 0) {
-            if (log.isDebugEnabled()) {
-                log.debug("  SSL redirect is disabled");
+            if (log.isTraceEnabled()) {
+                log.trace("  SSL redirect is disabled");
             }
             response.sendError(HttpServletResponse.SC_FORBIDDEN, 
request.getRequestURI());
             return false;
@@ -1028,8 +1028,8 @@ public abstract class RealmBase extends 
LifecycleMBeanBase implements Realm {
             file.append('?');
             file.append(queryString);
         }
-        if (log.isDebugEnabled()) {
-            log.debug("  Redirecting to " + file.toString());
+        if (log.isTraceEnabled()) {
+            log.trace("  Redirecting to " + file.toString());
         }
         response.sendRedirect(file.toString(), 
transportGuaranteeRedirectStatus);
         return false;
@@ -1180,8 +1180,8 @@ public abstract class RealmBase extends 
LifecycleMBeanBase implements Realm {
     protected Principal getPrincipal(X509Certificate usercert) {
         String username = x509UsernameRetriever.getUsername(usercert);
 
-        if (log.isDebugEnabled()) {
-            log.debug(sm.getString("realmBase.gotX509Username", username));
+        if (log.isTraceEnabled()) {
+            log.trace(sm.getString("realmBase.gotX509Username", username));
         }
 
         return getPrincipal(username);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org


Reply via email to