What's the best way to log all of the exceptions in a pyqt4 application using the standard python logging api?
I've tried wrapping exec_() in a try, except block, and logging the exceptions from that, but it only logs exceptions from the initialization of the app.
As a temporary solution, I wrapped the most important methods in try, except blocks, but that can't be the only way to do it.
You need to override sys.excepthook
def my_excepthook(type, value, tback):
# log the exception here
# then call the default handler
sys.__excepthook__(type, value, tback)
sys.excepthook = my_excepthook
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With