Catching a python app before it exits
        Posted  
        
            by Leopd
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Leopd
        
        
        
        Published on 2010-03-29T01:54:55Z
        Indexed on 
            2010/03/29
            2:03 UTC
        
        
        Read the original article
        Hit count: 492
        
I have a python app which is supposed to be very long-lived, but sometimes the process just disappears and I don't know why. Nothing gets logged when this happens, so I'm at a bit of a loss.
Is there some way in code I can hook in to an exit event, or some other way to get some of my code to run just before the process quits? I'd like to log the state of memory structures to better understand what's going on.
© Stack Overflow or respective owner