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

Use ShortenedThrowableConverter in logback config #279

Merged
merged 13 commits into from
Sep 6, 2024

Conversation

eidottermihi
Copy link
Member

Description

ensures JSON formatted log lines are not cut off if too long (e.g. on docker with maximum 16kb per line on STDOUT) and breaking log managment tools that rely on proper formatted JSON messages

Reference

Issues #90

@eidottermihi eidottermihi requested a review from a team as a code owner August 30, 2024 18:19
@github-actions github-actions bot added Template: Backend Issues regarding the backend template. Template: EAI Issues regarding the eai template. labels Aug 30, 2024
refarch-eai/pom.xml Outdated Show resolved Hide resolved
Copy link
Member

@devtobi devtobi left a comment

Choose a reason for hiding this comment

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

I tested it locally and for some reason the JSON-formatted logging is used for all tests when running via mvn test (not just the ones annotated with the JSON-Logging profile).

On top of that please make sure you apply the following to your code:

  • Run formatter via spotless:apply
  • Fix Linter errors from PMD and SpotBugs via pmd:check and spotbugs:check

Everything else looks fine to me. 👍

@eidottermihi
Copy link
Member Author

* Fix Linter errors from PMD and SpotBugs via `pmd:check` and `spotbugs:check`

@devtobi PMD reports errors in test sources of refarch-backend, but there's a discrepancy in PMD maven plugin configuration:

in refarch-backend tests are explicitely included (<includeTests>true</includeTests>), in refarch-eai not (default of includeTests is false).

Is this an configuration mistake? If not, I will fix PMD violations in the test sources of the backend.

@simonhir
Copy link
Member

simonhir commented Sep 4, 2024

This would also be a candidate for a refarch lib or what do you think @devtobi? See it-at-m/refarch#55
And even if not that should probably be also migrated to the refarch-gateway

@devtobi
Copy link
Member

devtobi commented Sep 4, 2024

* Fix Linter errors from PMD and SpotBugs via `pmd:check` and `spotbugs:check`

@devtobi PMD reports errors in test sources of refarch-backend, but there's a discrepancy in PMD maven plugin configuration:

in refarch-backend tests are explicitely included (<includeTests>true</includeTests>), in refarch-eai not (default of includeTests is false).

Is this an configuration mistake? If not, I will fix PMD violations in the test sources of the backend.

This is definitely a configuration mistake. Please enable <includeTests>true</includeTests> for refarch-eai as well, there shouldn't be too much errors being reported, because we only have very few tests. :)

Thanks. :)

@eidottermihi
Copy link
Member Author

I tested it locally and for some reason the JSON-formatted logging is used for all tests when running via mvn test (not just the ones annotated with the JSON-Logging profile).

That's fixed now (marked the test with @DirtiesContext), although I still think that should not have been necessary because a Spring Test context is only shared when the context is "almost the same", and here the Spring profiles are different. So somehow the logger configuration only properly resets with an explicit @DirtiesContext 🤷

On top of that please make sure you apply the following to your code:

* Run formatter via `spotless:apply`

* Fix Linter errors from PMD and SpotBugs via `pmd:check` and `spotbugs:check`

done

refarch-backend/src/main/resources/logback-spring.xml Outdated Show resolved Hide resolved
refarch-eai/pom.xml Outdated Show resolved Hide resolved
refarch-eai/src/main/resources/logback-spring.xml Outdated Show resolved Hide resolved
@devtobi devtobi added the Type: Dependency The issue is a dependency update. label Sep 6, 2024
@eidottermihi eidottermihi requested a review from devtobi September 6, 2024 09:54
Copy link
Member

@devtobi devtobi left a comment

Choose a reason for hiding this comment

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

LGTM now. :)

@eidottermihi eidottermihi force-pushed the 90-limit-logback-json-max-logline-size branch from d060e1c to ef88498 Compare September 6, 2024 11:50
@eidottermihi eidottermihi merged commit 9c50f4d into main Sep 6, 2024
5 checks passed
@eidottermihi eidottermihi deleted the 90-limit-logback-json-max-logline-size branch September 6, 2024 11:56
@hupling
Copy link
Contributor

hupling commented Sep 26, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Template: Backend Issues regarding the backend template. Template: EAI Issues regarding the eai template. Type: Dependency The issue is a dependency update.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants