mallesh-bot opened a new pull request, #817:
URL: https://github.com/apache/wayang/pull/817
Closes #536
## Problem
Wayang uses Log4j 2 (`log4j-bom` 2.20.0), but `bin/wayang-submit` passed the
Log4j 1 property when `FLAG_LOG=true`:
```
-Dlog4j.configuration=file://${WAYANG_CONF}/log4j.properties
```
Log4j 2 ignores that property, and `conf/` did not ship a logging
configuration, so `FLAG_LOG` had no effect. Running WordCount from the
distribution with `FLAG_LOG=true` on current `main` prints:
```
ERROR StatusLogger Reconfiguration failed: No configuration found for
'289d1c02' at 'null' in 'null'
```
and only errors are logged. A file created manually in `$WAYANG_HOME/conf`
is also lost on the next clean install, because that directory is regenerated
from the source `conf/` directory by the assembly.
## Change
- `bin/wayang-submit`: pass
`-Dlog4j2.configurationFile=file://${WAYANG_CONF}/log4j2.properties` when
`FLAG_LOG=true`.
- `conf/log4j2.properties` (new): default configuration, `INFO` and above to
stderr, so logs do not mix with application output on stdout. The assembly
already copies `conf/**` into the distribution.
- `wayang-assembly/README.md`: document `FLAG_LOG` next to `FLAG_WAYANG`.
Behaviour without `FLAG_LOG` is unchanged.
## Testing
All workflows of this repository passed on this commit in my fork (Backend
incl. license check, Maven and Python tests; Docker incl. WordCount smoke test;
CodeQL).
In addition I ran an end-to-end check on the built distribution image
(Linux, JDK 17):
- `FLAG_LOG=true`: Log4j 2 loads `/opt/wayang/conf/log4j2.properties`
without `StatusLogger` warnings or errors; Wayang's INFO/WARN logs (e.g. `INFO
Job: Preparing plan...`) appear on stderr in the configured format; stdout only
contains the WordCount result.
- `FLAG_LOG` unset: same output as before.
- Same run with the script from `main`: reproduces the `No configuration
found` error above.
## Notes (not changed here)
While checking which logging jars end up in `libs/`, I noticed the
distribution also ships `log4j-1.2.17.jar`, `reload4j-1.2.22.jar`,
`slf4j-reload4j-1.7.36.jar` and `slf4j-simple-2.0.16.jar` next to the Log4j 2
jars, which causes the `SLF4J: Class path contains multiple SLF4J providers`
warning. `wayang-api-sql` also has two `log4j.properties` files that reference
an undefined appender `A1` (visible as `log4j:ERROR Could not find value for
key log4j.appender.A1` in CI). I kept this PR focused on #536 and can follow up
on these separately if that is useful.
The contribution is my original work and I license the work to the project
under the project's open source license.
AI assistance: parts of this change were prepared with an AI tool (Claude
Code), disclosed in the commit with a `Generated-by:` trailer, following the
project's AI-assisted contributions guidelines.
🤖 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]