Closed Bug 657375 Opened 14 years ago Closed 8 years ago

StringLogger should not be used in webapiService.py

Categories

(Socorro :: General, task)

x86_64
Linux
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rhelmer, Unassigned)

Details

Found in bug 563110 comment 7: There is a StringLogger instantiated in http://code.google.com/p/socorro/source/browse/trunk/socorro/webapi/webapiService.py#43 This means that in mod_wsgi mode (which is our production/staging configuration) actual underlying exceptions are not logged, apache instead logs "IOError: sys.stdout access restricted by mod_wsgi". Was this put in for a reason or should we remove it in favor of using self.context.logger?
The whole error handling code of the middleware could use some work. I suggest that the GET function should have two exception handler blocks: 1) the firet one should handle the web.py family of exceptions raised by services. It should just log the exception to self.context.logger and then re-raise the exception. 2) this second handler should capture any other sundry exceptions. It should log them to self.context.logger and then turn the exception into some appropriate web.py exception. If it is difficult to translate into a web.py exception, it should just re-raise the exception and let web.py turn it into a 500 error. The idea of the string logger was to capture traceback data into a string, then put that into a new exception. This new exception is raised, which web.py turns into a 500 error that contains the traceback data. Honestly, that was mainly for debugging - it was useful to get the traceback in the return result. I don't think that is critical anymore.
Summary: StringLogger should be used in webapiService.py → StringLogger should not be used in webapiService.py
Component: Socorro → General
Product: Webtools → Socorro
webapiservice has been removed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.