Fix #453: Add logging-support module with StructuredArgumentsConverter#454
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new logging-support module to java-core intended for dev/test Logback configurations, providing a custom ClassicConverter to render StructuredArguments.kv() key-value pairs in plain-text log patterns (addressing #453).
Changes:
- Added new Maven module
logging-supportand included it in the parent build. - Implemented
StructuredArgumentsConverterand accompanying JUnit tests. - Published the new module via the project BOM.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pom.xml |
Registers logging-support module and introduces logstash.version property. |
bom/pom.xml |
Adds logging-support to dependency management so consumers can import it consistently. |
logging-support/pom.xml |
Defines the new module and its Logback / logstash encoder dependencies plus test setup. |
logging-support/src/main/java/com/wultra/core/logging/logback/StructuredArgumentsConverter.java |
Adds the Logback pattern converter that appends structured key/value pairs. |
logging-support/src/test/java/com/wultra/core/logging/logback/StructuredArgumentsConverterTest.java |
Adds unit tests covering structured, empty, null, and mixed argument cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
banterCZ
left a comment
There was a problem hiding this comment.
May we please include that in the changelog and README?
a48bfd3 to
3c159e1
Compare
|
Added Changelog entry for #453 and a new Wultra Logging Support section to the README documenting |
banterCZ
left a comment
There was a problem hiding this comment.
Thanks for reflecting the comments.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3c159e1 to
18b1ff8
Compare
Summary
Adds a new
logging-supportmodule tojava-corewith a LogbackPatternConverterthat makesStructuredArguments.kv()fields visible in plain-text log output (dev and test environments).Closes #453
Problem
logstash-logback-encoder'skv()arguments are JSON-only by default — without a{}placeholder in the message, structured key-value pairs are invisible in plain Logback text output. This creates a poor developer experience when running tests or the application locally.Solution
New
StructuredArgumentsConverter(extendsClassicConverter) reads the logging event's argument array, picks outStructuredArgumentinstances, and renders them as{key=value, ...}prepended with a space and appended to the log line. Returns empty string when no structured arguments are present — no trailing whitespace.Note
This converter is intended exclusively for dev and test log configurations (
logback-dev.xml,logback-test.xml). Production configs useLogstashEncoderwhich already serialiseskv()as JSON fields — no production change needed.Usage
Example output:
Changes
pom.xml<module>logging-support</module>,<logstash.version>9.0</logstash.version>bom/pom.xmllogging-supportto BOMlogging-support/pom.xmllogstash-logback-encoderas regular transitive dependencyStructuredArgumentsConverter.javaStructuredArgumentsConverterTest.javaChangelog.mdREADME.md