Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add customer logging provider to support structured logging for SLF4J 1.x + Logback 1.2.x #3693

Open
wants to merge 61 commits into
base: main
Choose a base branch
from

Conversation

JoeWang1127
Copy link
Collaborator

@JoeWang1127 JoeWang1127 commented Mar 12, 2025

In this PR:

  • Add Custom logging provider to support structured logging for SLF4J 1.x + Logback 1.2.x.
  • Add showcase tests.

b/394880750

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Mar 12, 2025
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Mar 12, 2025
@JoeWang1127 JoeWang1127 changed the title feat: add sdk logging helpers feat: add customer logging provider to support structured logging for SLF4J 1.x + Logback 1.2.x Mar 13, 2025
@JoeWang1127 JoeWang1127 marked this pull request as ready for review March 18, 2025 17:26
for (Map.Entry<String, String> entry : mdcProperties.entrySet()) {
String fieldName = entry.getKey();
String entryValueString = entry.getValue();
if (fieldName == null || entryValueString == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

logstash-logback has some customization capabilities that I suspect are fairly easy to restore here, like configure specific entries in the MDC to be included or excluded and renaming keys, ref: readme:mdc-fields. It might be as easy as adding these conditions here, or a bit more involved. Can you take a look? I think it nice to have it preserved.
https://github.com/logfellow/logstash-logback-encoder/blob/76f5295f35bc44518af91bfccb07a8ecb142229c/src/main/java/net/logstash/logback/composite/loggingevent/MdcJsonProvider.java#L102-L103

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added these features.

@JoeWang1127 JoeWang1127 requested a review from zhumin8 March 18, 2025 21:00
Copy link

Copy link

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants