2

Actual Problem (Crash Log Generation)

Is there a python module that could help me produce meaningful crash logs? Or a good way to go about producing them?

I want my crash logs to contain:

  • All variables within the current execution stack
  • All global variables
  • Parameters at invocation (i.e. flags, their values, etc)

Is this something I'd just be better off writing myself?

Context (Not particularly relevant)

I have a program that is used by a large number of people within my company that I am responsible for supporting. Unfortunately it doesn't always work correctly (about 1 out of 1000 times) and I am having difficulty tracking the bug down. I think that having solid crash logs would really help here so that my users could just submit those rather than making vague phone calls for help.

user126597
  • 21
  • 2
  • This doesn't directly answer your question, but it may help debugging the problem. Basically, you can define a decorator that will grab the stack trace and the local variables in the event an exception is raised. I haven't implemented it yet myself, but I can already see that this will save me boatloads of time debugging: http://stackoverflow.com/questions/14719363/a-fail-safe-for-long-running-python-scripts – BenDundee Feb 13 '13 at 14:56

2 Answers2

3

You can look at how django generates its error pages: https://github.com/django/django/blob/master/django/views/debug.py#L59

In non-debug mode these are mailed to the list of admins in the settings file. It's super handy!

boxed
  • 3,895
  • 2
  • 24
  • 26
  • I concur. I can usually find the source, cause and solution to a bug just by looking at the email Django sends me. The best part is that it even includes session data, so I often send a comforting email to the person that got the bug without them even reporting it. – nicbou Feb 13 '13 at 14:59
  • Yea, I do that too. Or at work, force som colleague to send the email since customers shouldn't have direct access to developers mail address :P – boxed Feb 14 '13 at 12:20
0

The python logging module has everything you need already.

nicbou
  • 1,047
  • 11
  • 16