Comments

minoroffense’s picture

Assigned: Unassigned » CptCasual
CptCasual’s picture

StatusFileSize
new1.26 KB

Added log for 301.
Restclient logs now take a parameter for the log severity level.

CptCasual’s picture

Status: Active » Needs review
minoroffense’s picture

First, when you submit a patch you should set it to "Needs Review" in the status.

minoroffense’s picture

Status: Needs review » Needs work

Next, a few notes:

  1. Instead of just 301s, let's do this on any 3XX class response code. There's a function in the module that returns which class of response code. Use that.
  2. The message in the log should not be empty. Return something like "Redirection response when calling @url" or something like that. Explain why this is in the log.
minoroffense’s picture

When you have a new patch, set the status back to "needs review"

CptCasual’s picture

StatusFileSize
new1.63 KB

Changed to log all 3XX response codes.
Modified the message. Note that the message is formatted in _restclient_watchdog.

Questions about if (variable_get('restclient_watchdog', TRUE))
1. Should it be checked on line 804? Or be moved inside _restclient_watchdog so the callers don't have to check it?
2. Would it be more correct to reverse the logic as: if (!variable_get('restclient_watchdog', FALSE))

CptCasual’s picture

Status: Needs work » Needs review
minoroffense’s picture

Status: Needs review » Needs work

1. Yeah moving that into the function makes sense. Do that.
2. What's the advantage to reversing the login? Are we changing the default behavior? If so we'll need to notify users and decide if it's worth it.

CptCasual’s picture

Currently, if the restclient_watchdog config var is not present then the logs are on (TRUE) by default.
(Oops, comment 7 question 2 should not have the NOT.)

CptCasual’s picture

Status: Needs work » Needs review
StatusFileSize
new2.07 KB

Moved the check for logging config into the log function.

CptCasual’s picture

Assigned: CptCasual » minoroffense

Assigning to minorOffense for review.

CptCasual’s picture

StatusFileSize
new2.62 KB

Updated the admin config text since Watchdog logs are not just for errors now.

CptCasual’s picture

Title: Log 301 responses to watchdog as warnings » Log 3XX redirect responses to watchdog
CptCasual’s picture

I had not added 3xx logs for POST and PUT. Fixed now.

IMPORTANT QUESTION: 5xx responses do not get logged because $response->error is not set. Should 5xx also get logged?

CptCasual’s picture

minoroffense’s picture

Assigned: minoroffense » CptCasual
Status: Needs review » Needs work

Yeah we could do 5XX responses too.

Only code change I would make is change the text to read "Enable logging" and add a #description to the form saying "Log error, redirect or not found responses".

CptCasual’s picture

Assigned: CptCasual » minoroffense
Status: Needs work » Needs review
StatusFileSize
new3.32 KB

Changed the config text, per review.

Have not implemented logging for 5xx.
Mat: Would you like me to create a new issue for logging 5xx?

minoroffense’s picture

Assigned: minoroffense » Unassigned
Status: Needs review » Reviewed & tested by the community

Yeah create a new issue

minoroffense’s picture

Assigned: Unassigned » CptCasual
Status: Reviewed & tested by the community » Needs work

Can you rebuild this patch against the latest dev. Also, be sure to add a variable_del('restclient_watchdog') in hook_uninstall (see restclient.install for examples).

CptCasual’s picture

Rebuilt patch against 7.x-2.x.
Added variable_del('restclient_watchdog') in hook_uninstall.

CptCasual’s picture

@minorOffense : Does this stay as a patch or should I request a merge?

minoroffense’s picture

If you have a working branch you can create the merge request in Gitlab.

CptCasual’s picture

Status: Needs work » Needs review

  • spotzero committed 20fea82 on 7.x-2.x authored by CptCasual
    Issue #2178943 by CptCasual: Log 3XX redirect responses to watchdog
    
spotzero’s picture

Status: Needs review » Fixed

Fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.