def setup_logging(self):
self.logpath = os.environ.get(self.LOGENVCONF, self.LOGGING)
try:
#logging.config.fileConfig(self.logpath)
with open(self.logpath) as logconfig:
logdata = yaml.load(logconfig)
logging.config.dictConfig(logdata)
except Exception as e:
print("Error with '%s': %s" % (self.logpath, e))
logging.basicConfig(level=self.LOGLEVEL, format=self.OUTPUT_FORMAT)
lfile = False
else:
lfile = True
self.logger = logging.getLogger(self.PROG)
if not lfile:
self.logger.info("Using default logging settings")
else:
self.logger.info("Using logging settings from '%s'" % self.logpath)
评论列表
文章目录