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

csutherl pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 48aa0f6345 Prevent duplicate cluster unavailability log message
48aa0f6345 is described below

commit 48aa0f63454ff6768b90a4b4f23777f9706bb53b
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 a50a2972b3..4c597dcfea 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -363,6 +363,10 @@
       <update>
         Update Commons Daemon to 1.6.0. (markt)
       </update>
+      <fix>
+        Prevent duplicate log messages when clustering JARs are not present on
+        startup. (csutherl)
+      </fix>
     </changelog>
   </subsection>
 </section>


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

Reply via email to