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

csutherl 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 e311e702ac Prevent duplicate cluster unavailability log message
e311e702ac is described below

commit e311e702ac65193ec8944a2e70117297ceed06e1
Author: Coty Sutherland <[email protected]>
AuthorDate: Fri May 8 10:06:56 2026 -0400

    Prevent duplicate cluster unavailability log message
    
    Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
---
 java/org/apache/catalina/startup/Catalina.java | 17 +++++++++++++----
 webapps/docs/changelog.xml                     |  4 ++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index a5e7674892..ec1c8818ba 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -128,6 +128,12 @@ public class Catalina {
     protected boolean loaded = false;
 
 
+    /**
+     * Prevent duplicate log lines when clustering is unavailable.
+     */
+    protected boolean clusterUnavailabilityLogged = false;
+
+
     /**
      * Rethrow exceptions on init failure.
      */
@@ -595,10 +601,13 @@ public class Catalina {
             RuleSet ruleSet = (RuleSet) constructor.newInstance(prefix);
             digester.addRuleSet(ruleSet);
         } catch (Exception e) {
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("catalina.noCluster", 
e.getClass().getName() + ": " + e.getMessage()), e);
-            } else if (log.isInfoEnabled()) {
-                log.info(sm.getString("catalina.noCluster", 
e.getClass().getName() + ": " + e.getMessage()));
+            if (!clusterUnavailabilityLogged) {
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("catalina.noCluster", 
e.getClass().getName() + ": " + e.getMessage()), e);
+                } else if (log.isInfoEnabled()) {
+                    log.info(sm.getString("catalina.noCluster", 
e.getClass().getName() + ": " + e.getMessage()));
+                }
+                clusterUnavailabilityLogged = true;
             }
         }
     }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 65685672ff..e05c907131 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,10 @@
         <code>AprLifecycleListener</code> and gracefully fail when natives
         are not present. (csutherl)
       </fix>
+      <fix>
+        Prevent duplicate log messages when clustering JARs are not present on
+        startup. (csutherl)
+      </fix>
       <add>
         Add the Jakarta EE 12 XML schemas. (markt)
       </add>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to