multiprocessing-logging icon indicating copy to clipboard operation
multiprocessing-logging copied to clipboard

exc_info missing on record

Open Willem-J-an opened this issue 2 years ago • 3 comments
trafficstars

Hi @jruere,

I notice the library stringifies the exception info into exc_text, then clears the exc_info property.

This causes issues because the handler I'm using (AzureLogHandler) requires the exc_info property to determine the record was an exception. I understand why the exc_info property is cleared, but could it be possible to potentially parse the exc_text back into exc_info before submitting it to the sub_handler?

Thanks

Willem-J-an avatar May 02 '23 13:05 Willem-J-an

I solved it using tblib. It allows the pickling of exceptions. If I call it right before the exception gets send, I don't need to clear exc_info.

        if record.exc_info:
            pickling_support.install(record.exc_info[1])
            self.format(record)

Willem-J-an avatar May 04 '23 12:05 Willem-J-an

I'll look into tblib but bear in mind I'm very slow in working on this project.

jruere avatar May 05 '23 13:05 jruere

No worries, I copied and adapted the solution for my case. Just leaving this for posterity and in case you'd like to upgrade this library!

Willem-J-an avatar May 05 '23 16:05 Willem-J-an