Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workers.base: Log 500 error message #1637

Closed
wants to merge 1 commit into from

Conversation

wking
Copy link
Contributor

@wking wking commented Nov 3, 2017

This makes it a bit easier to debug than just logging the fact that there was an exception. Also restore logging in the URI-less case, since that was broken in 79011d0 (#1071) but not restored in 1ccebab (#1231).

@wking wking force-pushed the log-exception-error-message branch from 72b6ee7 to a8c35ff Compare November 3, 2017 22:08
@wking
Copy link
Contributor Author

wking commented Nov 3, 2017

I've expanded the scope a bit after discovering the wonders of exc_info, and pushed a new commit that uses exc_info where appropriate, and also:

@wking wking force-pushed the log-exception-error-message branch from a8c35ff to 9c9a4c1 Compare November 3, 2017 22:54
@wking
Copy link
Contributor Author

wking commented Nov 3, 2017

Tests for the lines I've touched may be more trouble than they're worth. I've worked up one for a broken worker_exit hook to show what they look like, but left the others untested for now. Let me now if the “coverage has worsened” errors are acceptable in this case, or if I need to push through and add enough similar tests to cover all of the log instances.

@wking wking force-pushed the log-exception-error-message branch from 9c9a4c1 to 2935604 Compare November 3, 2017 23:33
The argument is documented in [1], and we've been using it in some
cases since 410bcfa (Fix statsd logging to work on Python 3,
2015-04-20, benoitc#1010).  This commit goes through all of our log calls and
makes sure we're using it consistently.

For more examples of using exc_info instead of direct traceback calls,
see 0acfb55 (Let logging module handle traceback printing,
2016-02-05, benoitc#1201).  The traceback call I'm removing snuck in later
with f4842a5 (Log exception occurring during worker exit, 2016-05-04,
benoitc#1254).

I'm removing the "Error processing SSL request" debug messages,
because those will be handled by the subsequent handle_error call.
We've had them, for reasons that I'm not clear on, since 1198cc2
(handle ssl connections, 2012-12-14).

I've restored logging in the URI-less Worker.handle_error 500 case,
since that was broken in 79011d0 (Include request URL in error
message, 2015-07-08, benoitc#1071) but not restored in 1ccebab (prevent
crash when reporting an error, 2016-03-22, benoitc#1231).

Tests for the lines I've touched may be more trouble than they're
worth.  I've worked up one for a broken worker_exit hook to show what
they look like, but left the others untested for now.

[1]: https://docs.python.org/2/library/logging.html#logging.Logger.debug
@dpetukhov
Copy link

Hi. Your pull request can help fix my issue, check it out: #1660
So I'm voting to work this out and merge if everything is okay.

Will you PR fix issues related to SSLError exceptions?

@benoitc
Copy link
Owner

benoitc commented Dec 10, 2017

this is need q more carefull review, exposing traceback in logs can expose some private data. I will comment the changes asap.

@benoitc benoitc self-assigned this Dec 10, 2017
@tilgovi
Copy link
Collaborator

tilgovi commented Dec 10, 2017

Also, I don't think we need to add exc_info where the exception is the current exception on the stack and log.exception() is called.

@benoitc
Copy link
Owner

benoitc commented May 7, 2023

stalled but also this houd be revisited by having proper parsing of the log to remove any sensitive data. Maybe also that can be directly handled in the app when needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants