Skip to content

TUL/Reduce warn logs noise - 404 dedicated logger#1279

Merged
milanmajchrak merged 1 commit intocustomer/TULfrom
propagate/reduce-warn-logs-v2-TUL
Mar 16, 2026
Merged

TUL/Reduce warn logs noise - 404 dedicated logger#1279
milanmajchrak merged 1 commit intocustomer/TULfrom
propagate/reduce-warn-logs-v2-TUL

Conversation

@milanmajchrak
Copy link
Collaborator

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

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:

Copilot AI review requested due to automatic review settings March 13, 2026 14:39
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

This PR reduces REST API log noise by routing 404 (NOT_FOUND) client errors to a dedicated Log4j2 logger that is OFF by default, while refactoring the exception handler to centralize client-error logging and status-code configuration.

Changes:

  • Add a dedicated Log4j2 logger (org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice.NotFound) configured OFF by default.
  • Introduce a dedicated notFoundLog logger and a logClientError() helper to route 404s separately from other 4xx warnings.
  • Extract status-code parsing into getStatusCodesLoggedAsErrors() and add a new sendErrorResponseFromException() helper (currently unused).

Reviewed changes

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

File Description
dspace/config/log4j2.xml Adds an OFF-by-default logger dedicated to 404 REST responses.
dspace-server-webapp/src/main/java/org/dspace/app/rest/exception/DSpaceApiExceptionControllerAdvice.java Adds dedicated 404 logger + helper methods to reduce 404 warn noise and refactor logging/status-code handling.

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 TUL/Reduce warn logs noise - 404 dedicated logger Mar 13, 2026
@milanmajchrak milanmajchrak force-pushed the propagate/reduce-warn-logs-v2-TUL branch from d2b67c3 to 172cc68 Compare March 13, 2026 15:31
@milanmajchrak milanmajchrak force-pushed the propagate/reduce-warn-logs-v2-TUL branch from 172cc68 to 2a53308 Compare March 16, 2026 11:40
@milanmajchrak milanmajchrak merged commit b0334ff into customer/TUL Mar 16, 2026
3 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