From patchwork Thu Dec 1 03:36:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 5409 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B453423E0C for ; Thu, 1 Dec 2011 03:36:16 +0000 (UTC) Received: from mail-lpp01m010-f52.google.com (mail-lpp01m010-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 8FBE2A1857F for ; Thu, 1 Dec 2011 03:36:16 +0000 (UTC) Received: by laah2 with SMTP id h2so752081laa.11 for ; Wed, 30 Nov 2011 19:36:16 -0800 (PST) Received: by 10.152.111.170 with SMTP id ij10mr3328214lab.5.1322710576047; Wed, 30 Nov 2011 19:36:16 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.41.198 with SMTP id h6cs45243lal; Wed, 30 Nov 2011 19:36:15 -0800 (PST) Received: by 10.227.206.19 with SMTP id fs19mr2096707wbb.25.1322710573355; Wed, 30 Nov 2011 19:36:13 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ft20si1537928wbb.77.2011.11.30.19.36.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Nov 2011 19:36:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1RVxRV-0005XI-10 for ; Thu, 01 Dec 2011 03:36:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id EB8DFE0135 for ; Thu, 1 Dec 2011 03:36:12 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-scheduler X-Launchpad-Branch: ~linaro-validation/lava-scheduler/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 102 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 102: slightly tortuously propagate the logging config from scheduler to monitor Message-Id: <20111201033612.3996.78144.launchpad@ackee.canonical.com> Date: Thu, 01 Dec 2011 03:36:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14414"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: b4ad3e6972971754806cc1b3971954f781728b92 ------------------------------------------------------------ revno: 102 committer: Michael Hudson-Doyle branch nick: lava-scheduler timestamp: Thu 2011-12-01 16:32:52 +1300 message: slightly tortuously propagate the logging config from scheduler to monitor modified: lava_scheduler_app/management/commands/schedulermonitor.py lava_scheduler_daemon/board.py --- lp:lava-scheduler https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk You are subscribed to branch lp:lava-scheduler. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription === modified file 'lava_scheduler_app/management/commands/schedulermonitor.py' --- lava_scheduler_app/management/commands/schedulermonitor.py 2011-12-01 03:03:31 +0000 +++ lava_scheduler_app/management/commands/schedulermonitor.py 2011-12-01 03:32:52 +0000 @@ -58,7 +58,7 @@ else: handler = logging.FileHandler(logfile) handler.setFormatter( - logging.Formatter("[%(levelname)s] [%(name)s] %(message)s")) + logging.Formatter("M [%(levelname)s] [%(name)s] %(message)s")) logger.addHandler(handler) logger.setLevel(getattr(logging, loglevel.upper())) === modified file 'lava_scheduler_daemon/board.py' --- lava_scheduler_daemon/board.py 2011-12-01 03:03:31 +0000 +++ lava_scheduler_daemon/board.py 2011-12-01 03:32:52 +0000 @@ -56,7 +56,6 @@ self.log_file.flush() def processEnded(self, reason): - # This discards the process exit value. self.log_file.close() self.deferred.callback(None) @@ -141,9 +140,15 @@ fd, self._json_file = tempfile.mkstemp() with os.fdopen(fd, 'wb') as f: json.dump(json_data, f) + root_logger = logging.getLogger('') + root_level_name = logging._levelNames[root_logger.level] + root_handler = root_logger.handlers[0] args = [ 'setsid', 'lava-server', 'manage', 'schedulermonitor', - self.dispatcher, str(self.board_name), self._json_file] + self.dispatcher, str(self.board_name), self._json_file, + '-l', root_level_name] + if isinstance(root_handler, logging.FileHandler): + args.extend(['-f', root_handler.baseFilename]) self.logger.info('executing "%s"', ' '.join(args)) self.reactor.spawnProcess( SimplePP(d), 'setsid', childFDs={0:0, 1:1, 2:2},