Skip to content

MENDELU/Reduce warn logs noise - 404 dedicated logger#1278

Merged
milanmajchrak merged 2 commits intocustomer/mendelufrom
propagate/reduce-warn-logs-v2-mendelu
Mar 16, 2026
Merged

MENDELU/Reduce warn logs noise - 404 dedicated logger#1278
milanmajchrak merged 2 commits intocustomer/mendelufrom
propagate/reduce-warn-logs-v2-mendelu

Conversation

@milanmajchrak
Copy link
Collaborator

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

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:37
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 aims to reduce REST API 404 warning noise by routing NOT_FOUND client errors through a dedicated Log4j2 logger which is OFF by default, while also refactoring parts of the exception logging logic in DSpaceApiExceptionControllerAdvice.

Changes:

  • Add a dedicated Log4j2 logger for 404 NOT_FOUND responses (OFF by default).
  • Refactor status-code-to-log-level handling into helper methods (getStatusCodesLoggedAsErrors(), logClientError()).
  • Introduce sendErrorResponseFromException() helper intended for exposing exception messages in 4xx responses.

Reviewed changes

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

File Description
dspace/config/log4j2.xml Adds a dedicated logger entry for 404 NOT_FOUND responses (OFF by default).
dspace-server-webapp/src/main/java/org/dspace/app/rest/exception/DSpaceApiExceptionControllerAdvice.java Adds dedicated 404 logger usage and refactors client-error logging / status-code parsing into helpers.

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 MENDELU/Reduce warn logs noise - 404 dedicated logger Mar 13, 2026
@milanmajchrak milanmajchrak force-pushed the propagate/reduce-warn-logs-v2-mendelu branch from 33ea0e7 to 4afe794 Compare March 13, 2026 15:31
@milanmajchrak milanmajchrak force-pushed the propagate/reduce-warn-logs-v2-mendelu branch from 4afe794 to cb87430 Compare March 16, 2026 11:40
WorkflowCurationIT.curationTest fails when CreateMissingIdentifiersIT runs first,
because it pollutes the shared named plugin cache in LegacyPluginServiceImpl.

Port upstream fix from DSpace#11907 (dspace-7_x backport):
add clearNamedPluginClasses() call at test start to reset plugin state.

See: DSpace#8533
@milanmajchrak milanmajchrak merged commit 161a5d6 into customer/mendelu Mar 16, 2026
10 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