jason810496 opened a new pull request, #68696:
URL: https://github.com/apache/airflow/pull/68696

   ## Why
   
   A Java task's SLF4J logs (e.g. `logger.info(...)`) fell through to stderr, 
which the supervisor tags as `ERROR`, so every application log showed up as 
`ERROR` in the UI regardless of its real level.
   
   Java-Task code:
   ```java
   @Task(
       id = "extract"
   )
   public long extractValue(Client client) throws InterruptedException {
       logger.info("Hello from task");
       Object pythonXcom = client.getXCom("python_task_1");
       logger.info("Got XCom from Python Task 'python_task_1' {}", pythonXcom);
       Connection connection = client.getConnection("test_http");
       logger.info("Got con {}", connection);
   
       for(int i = 0; i < 3; ++i) {
           logger.info("Beep {}, next time will be {}", i, new Date());
           Thread.sleep(2000L);
       }
   
       logger.info("Goodbye from task");
       return (new Date()).getTime();
   }
   ```
   
   What Airflow UI got:
   <img width="1499" height="703" alt="Screenshot 2026-06-18 at 1 31 12 PM" 
src="https://github.com/user-attachments/assets/75dbbb4a-a7bd-44a9-9fa1-85deb5fc1678";
 />
   
   
   
   ## What
   
   - Ship an SLF4J binding inside the SDK (`AirflowSlf4jServiceProvider`) 
registered via `META-INF/services`, so `LoggerFactory.getLogger(...)` routes 
through the Airflow logs socket carrying each message's real level instead of 
writing to stderr.
   - Map SLF4J levels to the strings the supervisor (structlog `NAME_TO_LEVEL`) 
understands; `TRACE` maps to `debug` since there is no TRACE level on the 
Python side.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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