]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
change log behavior
authorRobin Wittler <robin.wittler@profitbricks.com>
Wed, 3 Aug 2011 12:27:11 +0000 (14:27 +0200)
committerRobin Wittler <robin.wittler@profitbricks.com>
Wed, 3 Aug 2011 12:27:11 +0000 (14:27 +0200)
testgit_build.py

index 1544b7fb234303cd4c2fd6ae1556b2c03ec4b70b..8f5dfe61204b06a83225de2f8e2ae34810ce4783 100755 (executable)
@@ -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)