juliuszsompolski opened a new pull request, #59255:
URL: https://github.com/apache/spark/pull/59255

   ### What changes were proposed in this pull request?
   
   `LogEntry.+` bound the concatenation to a `val`, which evaluated both 
entries as soon as `+` was called. This PR passes the concatenation to the 
by-name `LogEntry` constructor instead, so it is only evaluated when the entry 
is logged.
   
   ### Why are the changes needed?
   
   `LogEntry` is lazy so that a message is only formatted if its log level is 
enabled, but `+` (added in SPARK-56509) formatted both sides eagerly: 
`logTrace(log"..." + entry)` evaluated everything even with TRACE disabled. For 
example, `LastAttemptAccumulator.mergeLastAttempt` formats the accumulator's 
per-partition state into TRACE messages on every task completion.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added a test to `LoggingSuiteBase` (run by `StructuredLoggingSuite` and 
`PatternLoggingSuite`) that logs a concatenated entry with `logTrace` at INFO, 
DEBUG and TRACE, and checks that both sides of `+` are evaluated only at TRACE. 
It fails without this change.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (claude-opus-5-5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to