0

currently i am logging all my test from the console. I mean whatever is being displayed in console is being logged in the log file. However, if there is any exception raised during the script execution it is not being logged though its shows in the console.

Following is my logger class:

class Logging(object):
    def __init__(self, *files):
       self.files = files

    def write(self, obj):
       for f in self.files:
         f.write(obj)

sys.stdout  = functions.Logging(sys.stdout, logfile)}

Thanks, Tejas

1 Answer 1

2

Exceptions get written to sys.stderr, so you have to set up a logger for that file handle, too.

You may want to look into using the logging module for this sort of thing, though.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.