Zhuoxi2000 opened a new issue, #1463:
URL: https://github.com/apache/flink-agents/issues/1463

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   `FileTraceLogger.open()` and `Slf4jTraceLogger.open()` read 
`trace-log.pretty-print` with a raw `(Boolean)` cast on the agent config map.
   
   On Flink 1.x, `AgentConfigLoader` parses a legacy `flink-conf.yaml` line by 
line, so `agent.trace-log.pretty-print: true` arrives as the string `"true"`. 
`AgentConfiguration.get(TRACE_LOG_OUTPUT_PRETTY_PRINT)` converts it, but the 
loggers do not:
   
   ```
   java.lang.ClassCastException: class java.lang.String cannot be cast to class 
java.lang.Boolean
       at ...FileTraceLogger.open(FileTraceLogger.java:130)
   ```
   
   The exception escapes `TraceLogWriter.open()`, so the operator fails to 
open. The integer limits in the same methods (`getIntFromConfig`) already 
accept strings.
   
   Expected: a string value is parsed like other options (`"true"` / `"false"`).
   
   Location: 
`runtime/src/main/java/org/apache/flink/agents/runtime/tracelog/FileTraceLogger.java:130`,
 `Slf4jTraceLogger.java:112`.
   
   ### How to reproduce
   
   ```java
   Map<String, Object> agentConfig = new HashMap<>();
   agentConfig.put("trace-log.pretty-print", "true");
   FileTraceLogger logger = new FileTraceLogger(
           TraceLoggerConfig.builder()
                   .loggerType(LoggerType.FILE)
                   .property(TraceLoggerConfig.AGENT_CONFIG_PROPERTY_KEY, 
agentConfig)
                   .build());
   logger.open(openParams); // ClassCastException
   ```
   
   Same for `Slf4jTraceLogger`.
   
   ### Version and environment
   
   main at d0f819a7, Java 17, macOS.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


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