From: Robin Wittler Date: Wed, 3 Aug 2011 12:27:11 +0000 (+0200) Subject: change log behavior X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=6769a742deb8970c0fbee44546224a79ee9b41ef;p=profitbricks%2Fjenkins-build-scripts.git change log behavior --- diff --git a/testgit_build.py b/testgit_build.py index 1544b7f..8f5dfe6 100755 --- a/testgit_build.py +++ b/testgit_build.py @@ -62,13 +62,26 @@ SMTP_BUILD_SUCCESS = 'SUCCESSFULL' SMTP_BUILD_ERROR = 'NOT SUCCESSFULL' SMTP_FROM = '%s@profitbricks.com' %(pwd.getpwuid(os.geteuid()).pw_name) -logger = logging.getLogger(sys.argv[0]) +#logger = logging.getLogger(sys.argv[0]) +#logger.setLevel(logging.DEBUG) +#stream_handler = logging.StreamHandler() +#stream_handler.setLevel(logging.DEBUG) +#formatter = Formatter('%(asctime)s %(name)s[%(process)d] %(levelname)s: %(message)s') +#stream_handler.setFormatter(formatter) +#logger.addHandler(stream_handler) + +log_format = '%(asctime)s %(name)s[%(process)d] %(levelname)s: %(message)s' +formatter = Formatter(log_format) +logging.basicConfig( + format=log_format, + level=logging.DEBUG +) +logger = logging.getLogger(__file__) logger.setLevel(logging.DEBUG) -stream_handler = logging.StreamHandler() -stream_handler.setLevel(logging.DEBUG) -formatter = Formatter('%(asctime)s %(name)s[%(process)d] %(levelname)s: %(message)s') -stream_handler.setFormatter(formatter) -logger.addHandler(stream_handler) +#stream_handler = logging.StreamHandler() +#stream_handler.setLevel(logging.DEBUG) +#stream_handler.setFormatter(formatter) +#logger.addHandler(stream_handler) def send_email(result): smtp = smtplib.SMTP(SMTP_SERVER)