Skip to content
Browse files

only use consolehandler while installing cb/mb

Change-Id: If63025600a0dc5daf06bda37e9d6b647c1eab215
Reviewed-on: http://review.couchbase.org/12264
Tested-by: Farshid Ghods <farshid.ghods@gmail.com>
Reviewed-by: Farshid Ghods <farshid.ghods@gmail.com>
  • Loading branch information...
1 parent f6e5884 commit fe259f4c9eab2d5c55ee8ca965e18430b7959f7d @farshidce farshidce committed
Showing with 54 additions and 13 deletions.
  1. +33 −0 scripts.logging.conf
  2. +21 −13 scripts/install.py
View
33 scripts.logging.conf
@@ -0,0 +1,33 @@
+[loggers]
+keys=root
+
+[logger_root]
+handlers=screen,file
+level=DEBUG
+
+[formatters]
+keys=simple,complex
+
+[formatter_simple]
+format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
+
+[formatter_complex]
+format=[%(asctime)s] - [%(module)s] [%(thread)d] - %(levelname)s - %(message)s
+
+[handlers]
+keys=file,screen
+
+[handler_file]
+class=handlers.TimedRotatingFileHandler
+interval=midnight
+backupCount=5
+maxBytes=20000000
+formatter=complex
+level=INFO
+args=('scripts.log',)
+
+[handler_screen]
+class=StreamHandler
+formatter=simple
+level=INFO
+args=(sys.stdout,)
View
34 scripts/install.py
@@ -4,6 +4,7 @@
import getopt
import copy
+import logging
import sys
from threading import Thread
from datetime import datetime
@@ -21,6 +22,13 @@
import TestInput
+log = logging.getLogger()
+consoleHandler = logging.StreamHandler()
+consoleHandler.setLevel(logging.INFO)
+formatter = logging.Formatter("[%(asctime)s] - [%(module)s] [%(thread)d] - %(levelname)s - %(message)s")
+consoleHandler.setFormatter(formatter)
+log.addHandler(consoleHandler)
+
def usage(err=None):
print """\
Syntax: install.py [options]
@@ -176,7 +184,7 @@ def __init__(self):
Installer.__init__(self)
def initialize(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
start_time = time.time()
cluster_initialized = False
server = params["server"]
@@ -201,7 +209,7 @@ def initialize(self, params):
raise Exception("unable to initialize membase node")
def install(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
build = self.build_url(params)
remote_client = RemoteMachineShellConnection(params["server"])
info = remote_client.extract_remote_info()
@@ -212,7 +220,7 @@ def install(self, params):
bat_file = "install.bat"
server_path = "/cygdrive/c/Program Files/Membase/Server/"
dir_paths = ['/cygdrive/c/automation', '/cygdrive/c/tmp']
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
build = self.build_url(params)
remote_client.create_multiple_dir(dir_paths)
remote_client.copy_files_local_to_remote('resources/windows/automation', '/cygdrive/c/automation')
@@ -250,7 +258,7 @@ def __init__(self):
Installer.__init__(self)
def initialize(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
start_time = time.time()
cluster_initialized = False
server = params["server"]
@@ -263,7 +271,7 @@ def initialize(self, params):
time.sleep(5)
def install(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
build = self.build_url(params)
remote_client = RemoteMachineShellConnection(params["server"])
downloaded = remote_client.download_build(build)
@@ -277,7 +285,7 @@ def __init__(self):
Installer.__init__(self)
def initialize(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
start_time = time.time()
cluster_initialized = False
server = params["server"]
@@ -310,7 +318,7 @@ def initialize(self, params):
raise Exception("unable to initialize membase node")
def install(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
build = self.build_url(params)
remote_client = RemoteMachineShellConnection(params["server"])
info = remote_client.extract_remote_info()
@@ -322,7 +330,7 @@ def install(self, params):
server_path = "/cygdrive/c/Program Files/Couchbase/Server/"
dir_paths = ['/cygdrive/c/automation', '/cygdrive/c/tmp']
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
build = self.build_url(params)
remote_client.create_multiple_dir(dir_paths)
remote_client.copy_files_local_to_remote('resources/windows/automation', '/cygdrive/c/automation')
@@ -358,7 +366,7 @@ def __init__(self):
Installer.__init__(self)
def initialize(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
start_time = time.time()
cluster_initialized = False
server = params["server"]
@@ -371,7 +379,7 @@ def initialize(self, params):
time.sleep(5)
def install(self, params):
- log = logger.new_logger("Installer")
+# log = logger.new_logger("Installer")
build = self.build_url(params)
remote_client = RemoteMachineShellConnection(params["server"])
downloaded = remote_client.download_build(build)
@@ -385,7 +393,7 @@ def __init__(self):
Installer.__init__(self)
def install(self, params):
- log = logger.new_logger("CouchbaseSingleServerInstaller")
+# log = logger.new_logger("CouchbaseSingleServerInstaller")
build = self.build_url(params)
remote_client = RemoteMachineShellConnection(params["server"])
downloaded = remote_client.download_build(build)
@@ -396,7 +404,7 @@ def install(self, params):
time.sleep(5)
def initialize(self, params):
- log = logger.new_logger("CouchbaseSingleServerInstaller")
+# log = logger.new_logger("CouchbaseSingleServerInstaller")
start_time = time.time()
server = params["server"]
remote_client = RemoteMachineShellConnection(params["server"])
@@ -480,7 +488,7 @@ def parallel_install(self, servers, params):
def check_build(input):
- log = logger.new_logger("Get build")
+# log = logger.new_logger("Get build")
_params = copy.deepcopy(input.test_params)
_params["server"] = input.servers[0]
installer = installer_factory(_params)

0 comments on commit fe259f4

Please sign in to comment.
Something went wrong with that request. Please try again.