Skip to content

fix(samples): pin console log charset to UTF-8 - #76

Merged
Zhoujie628 merged 1 commit into
project-openan:mainfrom
tangzhiqiang:main
Sep 16, 2026
Merged

Zhoujie628 merged 1 commit into
project-openan:mainfrom
tangzhiqiang:main

Conversation

@tangzhiqiang

Copy link
Copy Markdown
Contributor

What changed

samples/src/main/resources/log4j2.properties — the console appender's layout now pins its charset
explicitly, 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 appender

Why

appender.file.layout.charset was already UTF-8, but the console appender had no charset set, so
it fell back to the JVM default — on Windows that is the legacy code page (GBK on Chinese
systems). Non-ASCII log text therefore rendered as mojibake:

  • task prompts and agent responses
  • A2A-T protocol content — the SDK logs full protocol bodies at DEBUG through the PROTOCOL logger

The same text was correct in logs/spn-demo.log but garbled on stdout, and therefore also garbled
in 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

mvn -B -pl samples -am verify
  • workflow-engine, spring-boot-starter — build green
  • samples — 97 tests, with the same 2 failures / 4 errors in SpringSpnDemoE2ETest that
    reproduce on the pristine baseline without this commit. The failure is
    PortInUseException on an ephemeral port the E2E demo binds (62478 on one run, 61222 on
    another — 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-latest is the authoritative gate for this module.

Docs

No documentation changes needed — this is a logging resource fix inside the samples module and
does not affect any documented API or configuration surface.

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>
@tangzhiqiang
tangzhiqiang requested a review from a team as a code owner September 16, 2026 01:53
@Zhoujie628
Zhoujie628 merged commit 3c370ac into project-openan:main Sep 16, 2026
3 checks passed
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.

2 participants