1
0
Fork 0

fix file logging bug: only log statements from pgcli.main were logged to file. attach file handler to the root pgcli instead of pgcli.main

This commit is contained in:
darikg 2015-01-10 18:01:14 -05:00
parent 78819664cd
commit 89363a15bc
1 changed files with 5 additions and 4 deletions

View File

@ -82,11 +82,12 @@ class PGCli(object):
handler.setFormatter(formatter)
self.logger.addHandler(handler)
self.logger.setLevel(level_map[log_level.upper()])
root_logger = logging.getLogger('pgcli')
root_logger.addHandler(handler)
root_logger.setLevel(level_map[log_level.upper()])
self.logger.debug('Initializing pgcli logging.')
self.logger.debug('Log file "%s".' % log_file)
root_logger.debug('Initializing pgcli logging.')
root_logger.debug('Log file "%s".' % log_file)
def connect_uri(self, uri):
uri = urlparse(uri)