D
daniel
I use a simple program to illustrate the problem:
import logging
def foo() :
raise ValueError("foo")
if __name__ == "__main__" :
try :
foo()
except ValueError :
logging.exception("caught here") -- seems re-raise the
exception and can't be caught
print "caught here" --- just works.
I'm expecting the exception to be caught silently, and print the msg to
some place, if I comment out the logging statement, it just works, but
now, the stack trace is printed as if the except statement was not
there!!
how could this happen, just weird.. can I make the logging module
behave as I expected?
tks in advance.
daniel
import logging
def foo() :
raise ValueError("foo")
if __name__ == "__main__" :
try :
foo()
except ValueError :
logging.exception("caught here") -- seems re-raise the
exception and can't be caught
print "caught here" --- just works.
I'm expecting the exception to be caught silently, and print the msg to
some place, if I comment out the logging statement, it just works, but
now, the stack trace is printed as if the except statement was not
there!!
how could this happen, just weird.. can I make the logging module
behave as I expected?
tks in advance.
daniel