Skip to content

Fix #453: Add logging-support module with StructuredArgumentsConverter#454

Merged
vita-kotacka merged 1 commit into
developfrom
feature/453-logging-support
May 15, 2026
Merged

Fix #453: Add logging-support module with StructuredArgumentsConverter#454
vita-kotacka merged 1 commit into
developfrom
feature/453-logging-support

Conversation

@vita-kotacka
Copy link
Copy Markdown
Member

@vita-kotacka vita-kotacka commented May 14, 2026

Summary

Adds a new logging-support module to java-core with a Logback PatternConverter that makes StructuredArguments.kv() fields visible in plain-text log output (dev and test environments).

Closes #453

Problem

logstash-logback-encoder's kv() 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 (extends ClassicConverter) reads the logging event's argument array, picks out StructuredArgument instances, 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 use LogstashEncoder which already serialises kv() as JSON fields — no production change needed.

Usage

<conversionRule conversionWord="sa"
    converterClass="com.wultra.core.logging.logback.StructuredArgumentsConverter"/>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%sa%n</pattern>

Example output:

10:35:22.123 [main] INFO  c.w.EnrollmentService - action: createIdentity, state: succeeded {processId=abc-123, identityVerificationId=def-456}

Changes

File Change
pom.xml Added <module>logging-support</module>, <logstash.version>9.0</logstash.version>
bom/pom.xml Added logging-support to BOM
logging-support/pom.xml New module; logstash-logback-encoder as regular transitive dependency
StructuredArgumentsConverter.java New converter class
StructuredArgumentsConverterTest.java 4 unit tests
Changelog.md Added entry for #453
README.md Added Wultra Logging Support section

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-support and included it in the parent build.
  • Implemented StructuredArgumentsConverter and 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.

Comment thread logging-support/pom.xml Outdated
Copy link
Copy Markdown
Member

@banterCZ banterCZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May we please include that in the changelog and README?

Comment thread logging-support/pom.xml
@vita-kotacka vita-kotacka force-pushed the feature/453-logging-support branch from a48bfd3 to 3c159e1 Compare May 15, 2026 09:41
@vita-kotacka
Copy link
Copy Markdown
Member Author

Added Changelog entry for #453 and a new Wultra Logging Support section to the README documenting StructuredArgumentsConverter usage.

Copy link
Copy Markdown
Member

@banterCZ banterCZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reflecting the comments.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread logging-support/pom.xml
Comment thread logging-support/pom.xml
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vita-kotacka vita-kotacka force-pushed the feature/453-logging-support branch from 3c159e1 to 18b1ff8 Compare May 15, 2026 11:26
@vita-kotacka vita-kotacka merged commit 533bcd9 into develop May 15, 2026
2 checks passed
@vita-kotacka vita-kotacka deleted the feature/453-logging-support branch May 15, 2026 11:34
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.

Add logging-support module with StructuredArgumentsConverter

3 participants