This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new c2b1ae0b4e Differentiate trace and debug log levels c2b1ae0b4e is described below commit c2b1ae0b4e86e41387e8eea394c76215cefd928e 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 c38e73fe5b..0d594bedf8 100644 --- a/java/org/apache/catalina/mapper/Mapper.java +++ b/java/org/apache/catalina/mapper/Mapper.java @@ -507,8 +507,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 db858028ba..0c2b778aa9 100644 --- a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java +++ b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java @@ -137,8 +137,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); @@ -169,9 +169,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); @@ -183,8 +183,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); @@ -198,8 +198,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); @@ -213,8 +213,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); @@ -230,8 +230,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 f850f4ca2d..31999a7b49 100644 --- a/java/org/apache/catalina/realm/CombinedRealm.java +++ b/java/org/apache/catalina/realm/CombinedRealm.java @@ -68,7 +68,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()))); } } @@ -101,20 +101,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; } @@ -128,19 +128,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; } @@ -154,19 +154,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; } @@ -265,19 +265,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; } @@ -299,19 +299,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; } @@ -329,8 +329,8 @@ 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())); } if (!(realm instanceof org.apache.catalina.GSSRealm)) { @@ -344,12 +344,12 @@ public class CombinedRealm extends RealmBase { authenticatedUser = ((org.apache.catalina.GSSRealm) 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 cff832dbd6..91953b1c75 100644 --- a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java +++ b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java @@ -121,8 +121,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"); } } @@ -142,8 +142,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; } @@ -151,8 +151,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 @@ -182,8 +182,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 71bd35ba21..df4dcfc2a4 100644 --- a/java/org/apache/catalina/realm/JAASRealm.java +++ b/java/org/apache/catalina/realm/JAASRealm.java @@ -349,8 +349,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 ? @@ -379,8 +379,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 @@ -438,23 +438,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; @@ -515,21 +517,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 4ac8bceace..fd85bda078 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -974,7 +974,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; } @@ -1263,8 +1265,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, credentials, roles); } @@ -1293,8 +1295,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 @@ -1505,8 +1507,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(); @@ -1520,8 +1522,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) { @@ -2226,8 +2228,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) { @@ -2692,10 +2694,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 0414ece4f1..60239bd04b 100644 --- a/java/org/apache/catalina/realm/MemoryRealm.java +++ b/java/org/apache/catalina/realm/MemoryRealm.java @@ -235,8 +235,8 @@ public class MemoryRealm extends RealmBase { String pathName = getPathname(); try (InputStream is = ConfigFileLoader.getInputStream(pathName)) { // 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 9eb3057f11..952e558705 100644 --- a/java/org/apache/catalina/realm/RealmBase.java +++ b/java/org/apache/catalina/realm/RealmBase.java @@ -418,8 +418,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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); } @@ -440,13 +440,13 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache } // 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(); @@ -484,8 +484,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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)); } } } @@ -529,8 +529,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache // 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; } @@ -555,8 +555,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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)); } @@ -599,8 +599,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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)); } @@ -661,8 +661,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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)); } @@ -716,8 +716,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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)); } @@ -748,8 +748,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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); @@ -791,50 +791,50 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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) { @@ -842,8 +842,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache // 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; @@ -855,8 +855,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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; @@ -898,12 +898,12 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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)); } } @@ -973,22 +973,22 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache // 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; } @@ -996,8 +996,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache } // 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; } @@ -1006,8 +1006,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache // 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; @@ -1037,8 +1037,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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; @@ -1219,8 +1219,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache 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