wenjin272 opened a new pull request, #1479:
URL: https://github.com/apache/flink-agents/pull/1479

   Linked issue: #1463
   Backport of #1464 to `release-0.4`.
   
   ### Purpose of change
   
   Allow string values for `trace-log.pretty-print` in both built-in Trace Log 
loggers, preventing a `ClassCastException` during logger initialization.
   
   #### Runtime flow
   
   `TraceLogWriter` passes the agent configuration map to the selected logger. 
Both loggers now read `TRACE_LOG_OUTPUT_PRETTY_PRINT` through 
`AgentConfiguration.get()` before configuring JSON output.
   
   #### Key decisions
   
   Reuse the existing typed configuration conversion. The cherry-pick conflicts 
are limited to imports: retain release-0.4's existing JSON mapper and add 
`AgentConfiguration`, without bringing in main's `JacksonMapperFactory` 
changes. The original fix and parameterized tests are preserved.
   
   ### Behavioral Semantics
   
   #### Interaction decisions and behavioral contracts
   
   The following behavior applies equally to FILE and SLF4J output:
   
   | Input | Result |
   | --- | --- |
   | String `"true"` (case-insensitive) | Pretty-printed, multiline JSON |
   | String `"false"` | Compact, single-line JSON |
   | Boolean | The configured Boolean value is used |
   | Missing or null | Default `false` is used |
   
   #### Failure behavior
   
   String Boolean values no longer cause a type-cast failure during `open()`. 
Other strings follow the existing `Boolean.parseBoolean` contract and evaluate 
to false. File I/O and other logger initialization failures retain their 
existing propagation behavior.
   
   ### Tests
   
   Rebuilt the affected modules and their reactor dependencies on 
`release-0.4`. All 49 focused tests passed (14 configuration tests and 35 
logger/writer tests), including Spotless checks.
   
   | Contract | Coverage |
   | --- | --- |
   | String `"true"` enables multiline output | 
`FileTraceLoggerTest.testPrettyPrintAcceptsStringValue`, 
`Slf4jTraceLoggerTest.testPrettyPrintAcceptsStringValue` |
   | String `"false"` produces single-line output | The same parameterized 
tests, with the false input |
   | Existing Boolean and default behavior | Existing logger tests and 
`AgentConfigurationTest` |
   
   ```bash
   mvn -o --batch-mode --no-transfer-progress -pl runtime -am test \
     
-Dtest=FileTraceLoggerTest,Slf4jTraceLoggerTest,TraceLogWriterTest,AgentConfigurationTest
 \
     -Dsurefire.failIfNoSpecifiedTests=false
   ```
   
   Byte Buddy was preloaded with `JAVA_TOOL_OPTIONS` for local Mockito 
execution. Full runtime, Python and cluster end-to-end suites were not run 
locally.
   
   ### API
   
   No public API or configuration key changes. This backport adds support for 
string Boolean values while retaining Boolean and default behavior.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Claude Code 2.1.259 (Claude Opus 5.5)
   Generated-by: Codex CLI 0.153.4 (GPT-6)
   


-- 
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]

Reply via email to