Repository navigation
fix(samples): pin console log charset to UTF-8 - #76
Merged
Merged
Conversation
The rolling file appender already pins its layout charset to UTF-8, but the console appender falls back to the JVM default, which on Windows is the legacy code page (GBK on Chinese systems). Non-ASCII log text - task prompts, A2A-T protocol content, agent responses - then renders as mojibake in console output and in any log collector that captures stdout. Set the console layout charset explicitly to match the file appender. Signed-off-by: tangzhiqiang <tangzhiqiang@gdcattsoft.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.
What changed
samples/src/main/resources/log4j2.properties— the console appender's layout now pins its charsetexplicitly, matching the rolling file appender that already did:
appender.console.layout.type=PatternLayout appender.console.layout.pattern=${LOG_PATTERN} +appender.console.layout.charset=UTF-8 # Rolling file appenderWhy
appender.file.layout.charsetwas alreadyUTF-8, but the console appender had no charset set, soit fell back to the JVM default — on Windows that is the legacy code page (
GBKon Chinesesystems). Non-ASCII log text therefore rendered as mojibake:
PROTOCOLloggerThe same text was correct in
logs/spn-demo.logbut garbled on stdout, and therefore also garbledin any log collector that captures stdout instead of the file. Pinning the console charset makes the
two appenders consistent.
Breaking changes
None. No API, configuration surface, or module behaviour changes. The only observable difference is
that console log output is now UTF-8 instead of the platform default, which is the intent.
Test results
workflow-engine,spring-boot-starter— build greensamples— 97 tests, with the same 2 failures / 4 errors inSpringSpnDemoE2ETestthatreproduce on the pristine baseline without this commit. The failure is
PortInUseExceptionon an ephemeral port the E2E demo binds (62478on one run,61222onanother — i.e. the port is picked dynamically and the local Windows box refuses it, most likely a
reserved port range). Identical counts on the baseline, so it is not a regression from this
change. CI on
ubuntu-latestis the authoritative gate for this module.Docs
No documentation changes needed — this is a logging resource fix inside the
samplesmodule anddoes not affect any documented API or configuration surface.