Closed (duplicate)
Project:
Drupal core
Version:
10.1.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Mar 2019 at 22:18 UTC
Updated:
13 Mar 2023 at 09:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
slip commentedHere's a patch to fix this.
don't think we need the specific 404/403 logging so I removed it. I'm happy to add those back if for some reason putting them into separate logging types is useful.
I kept support for the on404/on403 style method calls in case removing that would be considered breaking backwards compatibility. Doesn't hurt to have it in any case imo.
Comment #3
slip commentedSetting to needs work. I see there are references to the 'page not found' and 'access denied' logs. I'm thinking I'll add those back in and just make a generic fallback
Comment #5
primsi commentedSome contrib modules rely on the logic provided by existing methods (see redirect_404)
I re-added them but kept the 4xx fallback.
Comment #6
primsi commentedComment #7
berdirComment #8
berdirReroll for Drupal 9.
Comment #9
primsi commentedAdding a test.
Comment #11
joshua1234511Reviewed the Patch #9
https://www.drupal.org/files/issues/2020-07-09/4xx-log-3039266-9.patch
Php 7.4 and Drupal core 9.1 4xx-log-3039266-9.patch
Comment #12
johnwebdev commenteds/that a/that
This doesn't seem right?
/s/that a/that
Maybe a blank line, and a comment to explain what we're doing here to trigger the exception. Doesn't necessarily need a comment, but we can at least separate the preparation for the test, and the trigger of the exception.
Comment #13
primsi commentedThanks for the review. 3. should be correct, given that it's a fallback method for 4xx exceptions. Or did you mean something else?
Comment #14
samiullah commentedLooks good
I tested this manually
Before Applying the patch
1. Navigate to http://localhost:8888/drupal/node/1?_format=hal_json%27. (Replace localhost with ur site base url)
2. You should see site encountered error
3. Check DBlog
4. See latet php error
5. Now apply the latest patch given in #13
6. Repeat step 1 to 3
7. In dblog u should see 4xx error
This can be moved to RTBC
Comment #16
krzysztof domańskiRetested. https://www.drupal.org/pift-ci-job/1868692 It was a random test failure #2825845: DST-related test failures in FilterDateTimeTest.
Comment #17
vikashsoni commentedApplied #13 patch Working fine showing 4xx error in recent log
Comment #18
ranjith_kumar_k_u commentedThe last patch works fine.
Before patch

After patch

RTBC
Comment #19
ranjith_kumar_k_u commentedComment #20
catchOne cs error to fix:
Comment #21
quietone commentedI did a code review.
This type does not agree with the parameter declared in the function.
I think this can be changed so that the fallback method name is only generated when $possible_method does not exist. Also, tweaked the comment to make it read a bit better and wrap at 80 columns.
Lets be clear about what this does, "Tests that a 4xx errors are logged as a '4xx error'."
Change to "Create a uri that will cause a 406 error."
Add a comment above this line.
// Confirm that a php error was not logged and that a 4xx error was.
@uri is not used. Should it be?
Comment #22
ravi.shankar commentedHere I have addressed comment #20, #21.1, #21.3, #21.4, and #21.5.
Still needs work for #21.2 and #21.6
Comment #26
joshua1234511Updated the patch from #22
- Rerolled for 9.5.x
- Worked on the pending points from #21
Result:
Comment #27
joshua1234511Updated test
Comment #28
chi commentedDoesn't it duplicate #2828706: ExceptionLoggingSubscriber should not log HTTP 4XX errors using PHP logger channel?
Comment #32
quietone commentedI think Chi is right, that this is a duplicate of an earlier issue, #2828706: ExceptionLoggingSubscriber should not log HTTP 4XX errors using PHP logger channel.
I am closing this and moving credit.