Skip to content

[Assembly] Use Log4j 2 configuration in wayang-submit (#536) - #817

Open
mallesh-bot wants to merge 1 commit into
apache:mainfrom
mallesh-bot:fix-536-log4j2-submit
Open

mallesh-bot wants to merge 1 commit into
apache:mainfrom
mallesh-bot:fix-536-log4j2-submit

Conversation

@mallesh-bot

Copy link
Copy Markdown

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

Wayang depends on Log4j 2, but bin/wayang-submit passed the Log4j 1
property -Dlog4j.configuration when FLAG_LOG=true. Log4j 2 ignores that
property, and conf/ did not ship a logging configuration, so FLAG_LOG
had no effect.

Pass -Dlog4j2.configurationFile instead and ship a default
conf/log4j2.properties that logs INFO and above to stderr. Because the
file lives in the source conf/ directory, the assembly copies it into
the distribution and it is no longer lost on a clean install.

Generated-by: Claude Opus 5 (Claude Code)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

log4j issues

1 participant