diff --git a/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml b/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml
index 97c8b37386..0d089e5e97 100644
--- a/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml
+++ b/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml
@@ -49,6 +49,25 @@ public class Test {
__log.debug("bla" + "",e );
}
}
+}
+ ]]>
+
+
+
+ 1
+
diff --git a/pmd/rulesets/java/logging-jakarta-commons.xml b/pmd/rulesets/java/logging-jakarta-commons.xml
index 864b93a43a..b993c48741 100644
--- a/pmd/rulesets/java/logging-jakarta-commons.xml
+++ b/pmd/rulesets/java/logging-jakarta-commons.xml
@@ -104,7 +104,7 @@ public class Foo {
0 and count(ancestor::IfStatement/descendant::PrimaryExpression[ends-with(descendant::PrimaryPrefix/Name/@Image, 'isDebugEnabled')]) = 0]
+ //PrimaryPrefix[ends-with(Name/@Image, '.debug') and count(../descendant::AdditiveExpression) > 0 and count(ancestor::IfStatement/Expression/descendant::PrimaryExpression[ends-with(descendant::PrimaryPrefix/Name/@Image, 'isDebugEnabled')]) = 0]
]]>