Commit 36518458 authored by Marco Mariani's avatar Marco Mariani

fixed duplicate logging

parent 1e726abc
......@@ -16,6 +16,9 @@ class SlapgridCommand(ConfigCommand):
method_name = NotImplemented
default_pidfile = NotImplemented
CONSOLE_MESSAGE_FORMAT = '%(message)s'
LOG_FILE_MESSAGE_FORMAT = '[%(asctime)s] %(levelname)-8s %(name)s %(message)s'
def get_parser(self, prog_name):
ap = super(SlapgridCommand, self).get_parser(prog_name)
......@@ -64,23 +67,13 @@ class SlapgridCommand(ConfigCommand):
'this option will make all others computer partitions be ignored.')
return ap
def take_action(self, args):
config = self.fetch_config(args)
options = merged_options(args, config)
# XXX add formatter
# formatter = logging.Formatter(fmt='%(asctime)s %(name)-18s: '
# '%(levelname)-8s %(message)s',
# datefmt='%Y-%m-%dT%H:%M:%S')
#
# handler.setFormatter(formatter)
check_missing_parameters(options)
check_missing_files(options)
# XXX this action is logging twice
random_delay(options, logger=self.log)
slapgrid_object = create_slapgrid_object(options, logger=self.log)
......
......@@ -38,9 +38,9 @@ from slapos.cli_legacy.remove import remove
from slapos.cli_legacy.supply import supply
from slapos.cli_legacy.format import main as format
from slapos.cli_legacy.cache import cache_lookup
from slapos.grid.slapgrid import runComputerPartition as instance
from slapos.grid.slapgrid import runSoftwareRelease as software
from slapos.grid.slapgrid import runUsageReport as report
from slapos.cli_legacy.slapgrid import runComputerPartition as instance
from slapos.cli_legacy.slapgrid import runSoftwareRelease as software
from slapos.cli_legacy.slapgrid import runUsageReport as report
from slapos.cli_legacy.svcbackend import supervisord
from slapos.cli_legacy.svcbackend import supervisorctl
from slapos.cli_legacy.register import main as register
......
......@@ -35,11 +35,6 @@ import ConfigParser
from slapos.grid.svcbackend import launchSupervisord
logger = logging.getLogger('SVCBackend')
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
logger.addHandler(handler)
def getOptionDict(*argument_tuple):
usage = """
......@@ -78,6 +73,11 @@ Typical usage:
def supervisorctl(*argument_tuple):
logger = logging.getLogger('SVCBackend')
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
logger.addHandler(handler)
option_dict, args = getOptionDict(*argument_tuple)
import supervisor.supervisorctl
launchSupervisord(socket=option_dict['supervisord_socket'],
......@@ -87,6 +87,11 @@ def supervisorctl(*argument_tuple):
def supervisord(*argument_tuple):
logger = logging.getLogger('SVCBackend')
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
logger.addHandler(handler)
option_dict, _ = getOptionDict(*argument_tuple)
launchSupervisord(socket=option_dict['supervisord_socket'],
configuration_file=option_dict['supervisord_configuration_path'],
......
......@@ -46,7 +46,7 @@ import zope.interface
from interface import slap as interface
from xml_marshaller import xml_marshaller
fallback_logger = logging.getLogger()
fallback_logger = logging.getLogger(__name__)
fallback_handler = logging.StreamHandler()
fallback_logger.setLevel(logging.INFO)
fallback_logger.addHandler(fallback_handler)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment