On Sat, Oct 17, 2015 at 4:47 PM, <manjunatha.mahalinga...@gmail.com> wrote: > class Logger(): > def __init__(self,log): > self.terminal = sys.stdout > self.log = log > > def write(self, message): > self.terminal.write(message) > self.log.write(message) > > > for (dname, ip, port) in tuples : > sys.stdout =Logger(log)
Every time you construct a Logger, it snapshots the previous value of sys.stdout. By the time you've set them all up, sys.stdout is the last Logger created, which will chain to the one created previous to it, then the one before that, and finally to the actual console. Do you need to use sys.stdout at all? It would be a lot easier to ignore stdout and just write your logs directly to files. ChrisA -- https://mail.python.org/mailman/listinfo/python-list