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

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


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

commit a7e2b582f05d3b006f582918ef0e674d8fc0e30e
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 f55c7603a8..479da5fed8 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -129,6 +129,12 @@ public class Catalina {
     protected boolean loaded = false;
 
 
+    /**
+     * Prevent duplicate log lines when clustering is unavailable.
+     */
+    protected boolean clusterUnavailabilityLogged = false;
+
+
     /**
      * Generate Tomcat embedded code from configuration files.
      */
@@ -571,10 +577,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 373d7ebaae..91adec9a0f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -114,6 +114,10 @@
         Add support for literal <code>'%'</code> characters in access log
         output. Based on pull request <pr>1002</pr> by Fabian Hahn. (markt)
       </add>
+      <fix>
+        Prevent duplicate log messages when clustering JARs are not present on
+        startup. (csutherl)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">


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

Reply via email to