ZCU-DATA/Reduce warn logs noise - 404 dedicated logger#1275
Open
milanmajchrak wants to merge 1 commit intocustomer/zcu-datafrom
Open
ZCU-DATA/Reduce warn logs noise - 404 dedicated logger#1275milanmajchrak wants to merge 1 commit intocustomer/zcu-datafrom
milanmajchrak wants to merge 1 commit intocustomer/zcu-datafrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces REST API 404 warning log noise by routing NOT_FOUND client errors to a dedicated Log4j2 logger (OFF by default), while refactoring the REST exception advice to centralize client-error logging and configurable “log as ERROR” status-code handling.
Changes:
- Add a dedicated Log4j2 logger for 404 NOT_FOUND responses (default
OFF) inlog4j2.xml. - Introduce a dedicated
notFoundLogand extract helpers (logClientError(),getStatusCodesLoggedAsErrors()) inDSpaceApiExceptionControllerAdvice. - Add
sendErrorResponseFromException()helper intended for 4xx responses.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| dspace/config/log4j2.xml | Adds a dedicated (OFF-by-default) logger for 404 responses to suppress expected 404 noise. |
| dspace-server-webapp/src/main/java/org/dspace/app/rest/exception/DSpaceApiExceptionControllerAdvice.java | Refactors client error logging and status-code error handling; adds a new helper method for 4xx error responses. |
You can also share your feedback on Copilot code review. Take the survey.
...r-webapp/src/main/java/org/dspace/app/rest/exception/DSpaceApiExceptionControllerAdvice.java
Outdated
Show resolved
Hide resolved
| } else { | ||
| StackTraceElement[] trace = ex.getStackTrace(); | ||
| String location = trace.length <= 0 ? "unknown" : trace[0].toString(); | ||
| logClientError(statusCode, message, ex.getClass().getName(), location); |
...r-webapp/src/main/java/org/dspace/app/rest/exception/DSpaceApiExceptionControllerAdvice.java
Outdated
Show resolved
Hide resolved
5cc6d5f to
b9345b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of commits 1dc5339 and db67645 into customer/zcu-data.
Problem description
Original commits: