github-team-sync icon indicating copy to clipboard operation
github-team-sync copied to clipboard

Improve Logging on errors

Open Chocrates opened this issue 3 years ago • 2 comments

In some places we log exceptions and continue forward, here for example https://github.com/github/github-team-sync/blob/5d50752e9f1b812a9ddfe9f97ee666d3c3f349ac/githubapp/ldap.py#L87

Some of the errors printed currently are not that useful "mail" for instance when the actual exception is a missing attribute on the object,

We should clean this up.

Chocrates avatar Jun 07 '21 21:06 Chocrates

Hi @Chocrates, I'm Rishabh, Can you please elaborate this issue?

anonymousr007 avatar Oct 17 '21 11:10 anonymousr007

Thanks @anonymousr007, in many places we log the exception directly. The message that the exception throws are things like "mail" or other tersely worded errors. See https://github.com/github/github-team-sync/blob/a18ca46a12b251c27e0582f769e073e0a0d24fad/githubapp/ldap.py#L87

It looks like this was mostly fixed in the latest code to print stack traces https://github.com/github/github-team-sync/blob/main/app.py#L94

If you'd like you can use this one to focus on rewriting all the logging to use a unified pattern, possibly using logging see https://github.com/github/github-team-sync/blob/main/githubapp/okta.py#L7

I don't have a strong opinion on how logging gets done though, as long as we get stack traces for exceptions :)

cc: @primetheus

Chocrates avatar Oct 18 '21 13:10 Chocrates