etzel-mes opened a new pull request, #29842:
URL: https://github.com/apache/camel/pull/29842

   # Description
   
   With `camel run --logging-json` nothing was written to `<pid>.log` in the 
Camel directory of the CLI: `log4j2-json.properties` has the console appender 
only, while the color, no-color and off configurations also have the file 
appender. The file is what `camel log`, the TUI and the AI tools 
(`camel_get_log`, the reload checks) read, so with JSON logging they had 
nothing to show. The JSON configuration is older than the log file of `camel 
run` and was not given the appender then; #22337 closed the same gap for the 
configuration without color.
   
   The change gives `log4j2-json.properties` the file appender of 
`log4j2-no-color.properties`.
   
   - The console stays ECS JSON, for the log collector of a container.
   - The file keeps the pattern, so every reader works as it is. Writing JSON 
into the file would mean a second format in `camel log`, `LogFileReader` and 
the TUI.
   - A logging category with JSON logging no longer fails with `Unable to 
locate appender "file" for logger config ...`, as the appender it refers to now 
exists.
   
   Tests: `LogConfigurationTest` checks that the JSON configuration has the log 
file in the Camel directory of the CLI and logs to it, like the others, and 
that its file has the pattern of the configuration without color.
   
   Run on this branch (a timer route that logs at INFO and WARN and throws):
   
   | | before | after |
   |---|---|---|
   | console with `--logging-json` | ECS JSON | ECS JSON, no other line |
   | `<pid>.log` | 0 bytes | the pattern, no JSON line |
   | `camel log --follow=false` | nothing | the log |
   | `<name>-previous.log` after the run | 0 bytes | the log |
   | with `--logging-category=org.apache.camel.impl=DEBUG` | `ERROR Unable to 
locate appender "file"` on stderr | no error; the same 396 DEBUG events on the 
console and in the file |
   
   The upgrade guide has a line under "where the CLI writes its log files".
   
   - `mvn clean install -DskipTests` from the root folder was not run on this 
machine; `camel-jbang-run` and `camel-jbang-core` were built with the formatter 
and their logging tests run, and the change feeds no generator.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] [CAMEL-26924](https://issues.apache.org/jira/browse/CAMEL-26924)
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes. (Only the two changed modules 
were built; see above.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   Written with Claude Code (Claude Fable 5.2); the change was reviewed by a 
separate Claude Opus run.
   
   _Claude Code on behalf of etzel-mes_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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