[Assembly] Use Log4j 2 configuration in wayang-submit (#536) - #817
Open
mallesh-bot wants to merge 1 commit into
Open
mallesh-bot wants to merge 1 commit into
mallesh-bot wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #536
Problem
Wayang uses Log4j 2 (
log4j-bom2.20.0), butbin/wayang-submitpassed the Log4j 1 property whenFLAG_LOG=true:Log4j 2 ignores that property, and
conf/did not ship a logging configuration, soFLAG_LOGhad no effect. Running WordCount from the distribution withFLAG_LOG=trueon currentmainprints:and only errors are logged. A file created manually in
$WAYANG_HOME/confis also lost on the next clean install, because that directory is regenerated from the sourceconf/directory by the assembly.Change
bin/wayang-submit: pass-Dlog4j2.configurationFile=file://${WAYANG_CONF}/log4j2.propertieswhenFLAG_LOG=true.conf/log4j2.properties(new): default configuration,INFOand above to stderr, so logs do not mix with application output on stdout. The assembly already copiesconf/**into the distribution.wayang-assembly/README.md: documentFLAG_LOGnext toFLAG_WAYANG.Behaviour without
FLAG_LOGis 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.propertieswithoutStatusLoggerwarnings 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_LOGunset: same output as before.main: reproduces theNo configuration founderror above.Notes (not changed here)
While checking which logging jars end up in
libs/, I noticed the distribution also shipslog4j-1.2.17.jar,reload4j-1.2.22.jar,slf4j-reload4j-1.7.36.jarandslf4j-simple-2.0.16.jarnext to the Log4j 2 jars, which causes theSLF4J: Class path contains multiple SLF4J providerswarning.wayang-api-sqlalso has twolog4j.propertiesfiles that reference an undefined appenderA1(visible aslog4j:ERROR Could not find value for key log4j.appender.A1in 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