1 2 3 4 5 6 7 8 9 10 11 12 13
import logging, threading, sys class C(object): def __init__(self): print threading.currentThread() def __del__(self): logger.warn('%s deleted %r' % (threading.currentThread(), self)) if __name__ == '__main__': logger = logging.getLogger() logger.basicConfig(file='/tmp/x.log') c = C()