In this example, I want to write to console (std.out) in the try block;
but when an exception is thrown by the except block, I want to write the exception content to std.err which is re-directed to a log file.
I could just have a file opened in except block and write on to it. but that needs to be done for every try-catch block, so if there is an alternative for re-directing these exceptions to std.err and log the std.error.
>>> try:
... print "hello world"
... 1/0
... except ZeroDivisionError as e:
... print "exception"
...
hello world
exception