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

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


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

commit 3ed8b09bc32e2118af119c59b35bf030d1851e08
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 0a6b4abf46..98c2585e06 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;
+
+
     /**
      * Rethrow exceptions on init failure.
      */
@@ -597,10 +603,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 64e2d60874..e19e091f58 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>
 </section>


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

Reply via email to