fix(logging): migrate logback <if condition> attribute to <condition> element - #19375
fix(logging): migrate logback <if condition> attribute to <condition> element#19375chakru-r wants to merge 2 commits into
Conversation
… element
Logback stopped evaluating the `condition` attribute on <if> somewhere between
1.5.32 and 1.5.37. In 1.5.38, IfModelHandler only emits a deprecation warning
and takes its branch state from an object pushed by a separate <condition>
handler; the attribute form pushes nothing, so IfModel.branchState stays null
and both ThenModelHandler and ElseModelHandler call deepMarkAsSkipped().
Neither branch runs, so the optional Loki log-shipping appender is never
created: setting LOG_AGGREGATOR_ENDPOINT has no effect, and because logback
reports this as a deprecation warning rather than an error, the feature fails
silently. Console logging is unaffected, since STDOUT is defined
unconditionally.
Replace the gate with the supported <condition> element, which must precede
<if> rather than nest inside it, using the built-in Janino-free
ExpressionPropertyCondition:
!property("LOG_AGGREGATOR_ENDPOINT").isEmpty()
-> isDefined("LOG_AGGREGATOR_ENDPOINT")
&& !propertyEquals("LOG_AGGREGATOR_ENDPOINT", "")
property() returns "" for an unset key, so both clauses are required:
propertyEquals alone returns false for an unset key, which would invert the
meaning of the gate.
Verified on logback 1.5.38 against all six config files: AGGREGATOR attaches to
root only when LOG_AGGREGATOR_ENDPOINT is set to a non-empty value, and console
output is byte-identical in every case.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PR SummaryOverview All six service Upgrade notes document the same syntax change for operators who mount a custom Reviewed by Cursor Bugbot for commit 4c4af78. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
✅ Meticulous spotted 0 visual differences across 1085 screens tested: view results. Meticulous evaluated ~10 hours of user flows against your PR. Expected differences? Click here. Last updated for commit |
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="datahub-upgrade/src/main/resources/logback.xml">
<violation number="1" location="datahub-upgrade/src/main/resources/logback.xml:91">
P1: Custom agent: **Flag Security Vulnerabilities**
When `LOG_AGGREGATOR_ENDPOINT` is set to an `http://` URL, this new condition activates `Loki4jAppender`, which sends logs over plaintext HTTP. Require and validate an `https://` endpoint before attaching the appender.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| push API under that prefix rather than at the bare path. --> | ||
| <if condition='!property("LOG_AGGREGATOR_ENDPOINT").isEmpty()'> | ||
| <condition class="ch.qos.logback.core.boolex.ExpressionPropertyCondition"> | ||
| <expression>isDefined("LOG_AGGREGATOR_ENDPOINT") && !propertyEquals("LOG_AGGREGATOR_ENDPOINT", "")</expression> |
There was a problem hiding this comment.
P1: Custom agent: Flag Security Vulnerabilities
When LOG_AGGREGATOR_ENDPOINT is set to an http:// URL, this new condition activates Loki4jAppender, which sends logs over plaintext HTTP. Require and validate an https:// endpoint before attaching the appender.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At datahub-upgrade/src/main/resources/logback.xml, line 91:
<comment>When `LOG_AGGREGATOR_ENDPOINT` is set to an `http://` URL, this new condition activates `Loki4jAppender`, which sends logs over plaintext HTTP. Require and validate an `https://` endpoint before attaching the appender.</comment>
<file context>
@@ -87,7 +87,10 @@
push API under that prefix rather than at the bare path. -->
- <if condition='!property("LOG_AGGREGATOR_ENDPOINT").isEmpty()'>
+ <condition class="ch.qos.logback.core.boolex.ExpressionPropertyCondition">
+ <expression>isDefined("LOG_AGGREGATOR_ENDPOINT") && !propertyEquals("LOG_AGGREGATOR_ENDPOINT", "")</expression>
+ </condition>
+ <if>
</file context>
Initial JS bundle size ➡️
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/how/updating-datahub.md">
<violation number="1" location="docs/how/updating-datahub.md:88">
P3: The two entries describe the same 1.5.37+ behavior differently: line 86 says logback "silently ignores" the `condition` attribute, while line 88 says it "logs a deprecation warning" before skipping both branches. Only one can be right, and readers will rely on it to decide whether to watch the logs. Pick the accurate one and use it in both entries (if a deprecation warning is logged, change line 86's "silently ignores" to say the attribute is no longer honored and the failure is otherwise silent).</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| - **(Security / Dependencies)** Logback (`logback-classic` / `logback-core`) bumped from 1.5.32 to **1.5.38** for CVE-2026-9828 (`HardenedObjectInputStream` overly broad `java.lang`/`java.util` deserialization allowlist; fixed in 1.5.33+) and CVE-2026-10532 (Proxy class deserialization; fixed in 1.5.38). **Action:** none for operators; rebuild/redeploy picks up the new JARs. DataHub does not expose Logback `SimpleSocketServer` / `SimpleSSLSocketServer` by default. | ||
| - **(Security / Dependencies)** Logback (`logback-classic` / `logback-core`) bumped from 1.5.32 to **1.5.38** for CVE-2026-9828 (`HardenedObjectInputStream` overly broad `java.lang`/`java.util` deserialization allowlist; fixed in 1.5.33+) and CVE-2026-10532 (Proxy class deserialization; fixed in 1.5.38). **Action:** none for operators using the bundled logging config; rebuild/redeploy picks up the new JARs. If you supply your own `logback.xml` that uses `<if condition="...">`, see the #19375 entry below — 1.5.37+ silently ignores that attribute. DataHub does not expose Logback `SimpleSocketServer` / `SimpleSSLSocketServer` by default. | ||
|
|
||
| - #19375 **(Operations / logging)** Conditional blocks in `logback.xml` are evaluated again. Logback 1.5.37+ stopped honouring the `condition` attribute on `<if>`: it logs a deprecation warning and then skips both the `<then>` and the `<else>` branch, so the failure is silent. On `master` this left `LOG_AGGREGATOR_ENDPOINT` with no effect, because the optional Loki log-shipping appender was never created. No released version is affected — releases up to and including v1.7.0 ship Logback 1.5.32, which still evaluates the attribute. The bundled logging configs now use the supported `<condition>` element instead. **Action:** none if you use the bundled logging config. If you mount your own `logback.xml` containing `<if condition="...">`, those blocks are being ignored on 1.5.37+ — move the expression into a `<condition>` element placed immediately **before** the `<if>`: |
There was a problem hiding this comment.
P3: The two entries describe the same 1.5.37+ behavior differently: line 86 says logback "silently ignores" the condition attribute, while line 88 says it "logs a deprecation warning" before skipping both branches. Only one can be right, and readers will rely on it to decide whether to watch the logs. Pick the accurate one and use it in both entries (if a deprecation warning is logged, change line 86's "silently ignores" to say the attribute is no longer honored and the failure is otherwise silent).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/how/updating-datahub.md, line 88:
<comment>The two entries describe the same 1.5.37+ behavior differently: line 86 says logback "silently ignores" the `condition` attribute, while line 88 says it "logs a deprecation warning" before skipping both branches. Only one can be right, and readers will rely on it to decide whether to watch the logs. Pick the accurate one and use it in both entries (if a deprecation warning is logged, change line 86's "silently ignores" to say the attribute is no longer honored and the failure is otherwise silent).</comment>
<file context>
@@ -83,7 +83,21 @@ Requirements:
-- **(Security / Dependencies)** Logback (`logback-classic` / `logback-core`) bumped from 1.5.32 to **1.5.38** for CVE-2026-9828 (`HardenedObjectInputStream` overly broad `java.lang`/`java.util` deserialization allowlist; fixed in 1.5.33+) and CVE-2026-10532 (Proxy class deserialization; fixed in 1.5.38). **Action:** none for operators; rebuild/redeploy picks up the new JARs. DataHub does not expose Logback `SimpleSocketServer` / `SimpleSSLSocketServer` by default.
+- **(Security / Dependencies)** Logback (`logback-classic` / `logback-core`) bumped from 1.5.32 to **1.5.38** for CVE-2026-9828 (`HardenedObjectInputStream` overly broad `java.lang`/`java.util` deserialization allowlist; fixed in 1.5.33+) and CVE-2026-10532 (Proxy class deserialization; fixed in 1.5.38). **Action:** none for operators using the bundled logging config; rebuild/redeploy picks up the new JARs. If you supply your own `logback.xml` that uses `<if condition="...">`, see the #19375 entry below — 1.5.37+ silently ignores that attribute. DataHub does not expose Logback `SimpleSocketServer` / `SimpleSSLSocketServer` by default.
+
+- #19375 **(Operations / logging)** Conditional blocks in `logback.xml` are evaluated again. Logback 1.5.37+ stopped honouring the `condition` attribute on `<if>`: it logs a deprecation warning and then skips both the `<then>` and the `<else>` branch, so the failure is silent. On `master` this left `LOG_AGGREGATOR_ENDPOINT` with no effect, because the optional Loki log-shipping appender was never created. No released version is affected — releases up to and including v1.7.0 ship Logback 1.5.32, which still evaluates the attribute. The bundled logging configs now use the supported `<condition>` element instead. **Action:** none if you use the bundled logging config. If you mount your own `logback.xml` containing `<if condition="...">`, those blocks are being ignored on 1.5.37+ — move the expression into a `<condition>` element placed immediately **before** the `<if>`:
+
+ ```xml
</file context>
Add a Next entry for the <if condition> -> <condition> migration, and correct the Logback 1.5.38 bump entry's "Action: none for operators": anyone mounting their own logback.xml that uses <if condition="..."> loses those blocks silently on 1.5.37+, so that entry needed the caveat. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3e86a6f to
4c4af78
Compare
Problem
Setting
LOG_AGGREGATOR_ENDPOINThas no effect. The optional Loki log-shipping appender is never created, and nothing is logged to indicate why — logback reports the underlying cause as a deprecation warning rather than an error, so the feature fails silently.Console logging is not affected:
STDOUTis defined unconditionally in all of these files.Root cause
Logback stopped evaluating the
conditionattribute on<if>somewhere between 1.5.32 and 1.5.37. In 1.5.38 (the version pinned inbuild.gradle), the only consumer ofIfModel.getCondition()is the deprecation warning:In the attribute form nothing pushes that
BranchState, soIfModel.branchStatestaysnull, and bothThenModelHandlerandElseModelHandlercalldeepMarkAsSkipped(). Neither branch executes, so theAGGREGATORappender is never instantiated and never attached to<root>.Because the compose profiles default the variable to empty (
LOG_AGGREGATOR_ENDPOINT: ${LOG_AGGREGATOR_ENDPOINT:-}), no CI job ever takes the branch, which is why this went unnoticed.Logback's docs describe the attribute as deprecated with removal scheduled for January 2027, so this migration is needed regardless of the current breakage.
Fix
Replace the gate in all six
logback.xmlfiles with the supported<condition>element, which precedes<if>rather than nesting inside it, using the built-in Janino-freeExpressionPropertyCondition:!property("LOG_AGGREGATOR_ENDPOINT").isEmpty()isDefined("LOG_AGGREGATOR_ENDPOINT") && !propertyEquals("LOG_AGGREGATOR_ENDPOINT", "")property()returns""for an unset key, so both clauses are required —propertyEqualsalone returnsfalsefor an unset key, which would invert the meaning of the gate.&&is written&&because&is reserved in XML.Verification
Ran each of the six config files on logback 1.5.38 in a standalone harness (real configs, janino 3.0.12 as pinned, the Loki appender on the classpath), emitting one INFO event per configured logger and then inspecting
root.iteratorForAppenders():LOG_AGGREGATOR_ENDPOINTAGGREGATOR✅AGGREGATOR✅AGGREGATOR✅AGGREGATOR✅http://host:portAGGREGATOR❌AGGREGATORattached ✅Console output (event counts and formatting) is unchanged in every case, for all six services — gms, mae-consumer, mce-consumer, datahub-upgrade, and both frontend configs.
Checklist
LOG_AGGREGATOR_ENDPOINTbehaviour is unchanged from what is already documented, this only makes it work againNote for reviewers
This class of failure is silent by design on logback's side. A cheap guard would be a test that parses each
logback.xmland asserts logback'sStatusManagerreports zero errors and that expected appenders are attached — worth considering separately, since the same footgun applies to any future<if>usage.🤖 Generated with Claude Code
Summary by cubic
Restores Loki log-shipping by migrating Logback conditionals from deprecated
<if condition="...">to a preceding<condition>element. On 1.5.38 the attribute was ignored, soLOG_AGGREGATOR_ENDPOINThad no effect and theAGGREGATORappender was never created; now the gate evaluates and attaches the appender only when the variable is set.logback.xmlfiles (frontend conf/run, datahub-upgrade, mae-consumer, mce-consumer, metadata-service).ch.qos.logback.core.boolex.ExpressionPropertyConditionwithisDefined("LOG_AGGREGATOR_ENDPOINT") && !propertyEquals("LOG_AGGREGATOR_ENDPOINT", "");<condition>must precede<if>.STDOUTunchanged;AGGREGATORattaches only whenLOG_AGGREGATOR_ENDPOINTis non-empty.docs/how/updating-datahub.mdto warn that 1.5.37+ ignores<if condition="...">and that<condition>cannot be inside an<appender>,<logger>, or<root>; no action if using bundled configs, migrate custom files accordingly.Written for commit 4c4af78. Summary will update on new commits.