From 3fdc9a4a5b08155b3fb7b6fe7d111ca30190e5c5 2011-05-18 20:55:43 From: Luis Pedro Coelho Date: 2011-05-18 20:55:43 Subject: [PATCH] BUG Move setting of log_active flag down Previously, if there was an error opening the file (e.g., permission denied), then the object would end up in a state where log_active was True, but there was no logfile. The result was constant errors. --- diff --git a/IPython/core/logger.py b/IPython/core/logger.py index 39d8292..9fba405 100644 --- a/IPython/core/logger.py +++ b/IPython/core/logger.py @@ -69,8 +69,6 @@ class Logger(object): raise RuntimeError('Log file is already active: %s' % self.logfname) - self.log_active = True - # The parameters can override constructor defaults if logfname is not None: self.logfname = logfname if loghead is not None: self.loghead = loghead @@ -124,6 +122,7 @@ class Logger(object): self.logfile.write(self.loghead) self.logfile.flush() + self.log_active = True def switch_log(self,val): """Switch logging on/off. val should be ONLY a boolean."""