Skip to content

VSB-TUO/Reduce warn logs noise - 404 dedicated logger#1277

Merged
milanmajchrak merged 2 commits intocustomer/vsb-tuofrom
propagate/reduce-warn-logs-v2-vsb-tuo
Mar 13, 2026
Merged

VSB-TUO/Reduce warn logs noise - 404 dedicated logger#1277
milanmajchrak merged 2 commits intocustomer/vsb-tuofrom
propagate/reduce-warn-logs-v2-vsb-tuo

Conversation

@milanmajchrak
Copy link
Collaborator

Cherry-pick of commits 1dc5339 and db67645 into customer/vsb-tuo.

Problem description

  • Log 404 responses via dedicated Log4j2 logger (org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice.NotFound) set to OFF by default
  • Extract getStatusCodesLoggedAsErrors() and logClientError() helper methods
  • Add sendErrorResponseFromException() for 4xx errors
  • Fix row length to be less than 120 chars

Original commits:

* Log 404 responses at DEBUG instead of WARN to reduce log noise

* Log 404 responses at DEBUG instead of WARN (configurable via logging.server.debug-404)

* Skip stack trace extraction for suppressed 404 debug logs

* Replace custom debug-404 property with dedicated Log4j2 logger (org.dspace.app.rest.NotFound)

* Suppress 404 warn logs via dedicated Log4j2 logger (org.dspace.app.rest.NotFound)

* Turn off that warn logs for the dspace.log

* Updated log name to be more unique
Copilot AI review requested due to automatic review settings March 13, 2026 14:35
Copy link

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

Reduces REST API log noise by routing expected 404 NOT_FOUND responses to a dedicated Log4j2 logger that is OFF by default, while keeping other client/server errors logged as before.

Changes:

  • Add a dedicated Log4j2 logger configuration for 404 NOT_FOUND responses (default OFF).
  • Introduce a notFoundLog logger and centralize 4xx logging via logClientError(..) in DSpaceApiExceptionControllerAdvice.
  • Minor cleanup to keep log statements concise and within line-length limits.

Reviewed changes

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

File Description
dspace/config/log4j2.xml Adds dedicated 404 logger configuration (OFF by default).
dspace-server-webapp/src/main/java/org/dspace/app/rest/exception/DSpaceApiExceptionControllerAdvice.java Routes 404s to a dedicated logger and refactors 4xx WARN logging into a helper.

You can also share your feedback on Copilot code review. Take the survey.

@milanmajchrak milanmajchrak changed the title Reduce warn logs noise - 404 dedicated logger VSB-TUO/Reduce warn logs noise - 404 dedicated logger Mar 13, 2026
@milanmajchrak milanmajchrak merged commit 01b75e9 into customer/vsb-tuo Mar 13, 2026
15 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