I just spent a few hours debugging a 500 response code from the services module. It was very frustrating, as we were getting a 500 error, which indicates a server error:

The server encountered an unexpected condition which prevented it from fulfilling the request.

The Services module is pushing this error here (RESTServer.inc):

          $error_header_status_message = $this->formatHttpHeaderStatusMessage('500 Internal Server Error', "An error occurred ({$error_code}): {$error_message}");

The big issue here was that there was no data in the logs whatsoever to indicate what the problem was. Nothing in our apache error log, nothing in the Drupal watchdog. This left us scratching our heads, as our client was not showing us the error, only the error code.

When this error occurs, the error should be written to the watchdog for debugging purposes. I'm attaching a patch that will do this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jaypan’s picture

marcingy’s picture

Status: Active » Reviewed & tested by the community
marcingy’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
654 bytes

Actually why not use watchdog_exception().

Jaypan’s picture

Status: Needs review » Reviewed & tested by the community

Interesting, that's a new function for me. That looks to be a better option.

kylebrowning’s picture

Status: Reviewed & tested by the community » Fixed

  • kylebrowning committed b4b8945 on 7.x-3.x authored by Jaypan
    Issue #2521436 by Jaypan, marcingy: No log for 500 unknown error
    

Status: Fixed » Closed (fixed)

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