Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DFDC7200C55 for ; Thu, 13 Apr 2017 16:16:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DB543160BB1; Thu, 13 Apr 2017 14:16:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 360EA160BAA for ; Thu, 13 Apr 2017 16:16:19 +0200 (CEST) Received: (qmail 43548 invoked by uid 500); 13 Apr 2017 14:16:18 -0000 Mailing-List: contact dev-help@ariatosca.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ariatosca.incubator.apache.org Delivered-To: mailing list dev@ariatosca.incubator.apache.org Received: (qmail 43412 invoked by uid 99); 13 Apr 2017 14:16:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 14:16:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 418E7C1812 for ; Thu, 13 Apr 2017 14:16:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.721 X-Spam-Level: X-Spam-Status: No, score=-3.721 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_NUMSUBJECT=0.5, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id BnztmyGncikG for ; Thu, 13 Apr 2017 14:16:14 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 502435FCD7 for ; Thu, 13 Apr 2017 14:16:11 +0000 (UTC) Received: (qmail 43206 invoked by uid 99); 13 Apr 2017 14:16:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 14:16:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2F59AE00B4; Thu, 13 Apr 2017 14:16:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: avia@apache.org To: dev@ariatosca.incubator.apache.org Date: Thu, 13 Apr 2017 14:16:14 -0000 Message-Id: <15572d28a34b46529427bb7b3ee19896@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [05/14] incubator-ariatosca git commit: added default NullHandler support for py26 archived-at: Thu, 13 Apr 2017 14:16:20 -0000 added default NullHandler support for py26 Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/d6458c03 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/d6458c03 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/d6458c03 Branch: refs/heads/cli-tests Commit: d6458c0391877f531471fec5764ee2d2dec21ec8 Parents: 207cc09 Author: max-orlov Authored: Thu Apr 13 17:05:57 2017 +0300 Committer: max-orlov Committed: Thu Apr 13 17:05:57 2017 +0300 ---------------------------------------------------------------------- aria/logger.py | 9 +++++++++ aria/storage/core.py | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d6458c03/aria/logger.py ---------------------------------------------------------------------- diff --git a/aria/logger.py b/aria/logger.py index bbb6c7a..41e1ac8 100644 --- a/aria/logger.py +++ b/aria/logger.py @@ -21,6 +21,15 @@ import logging from logging import handlers as logging_handlers from datetime import datetime +# NullHandler doesn't exist in < 27. this workaround is from +# http://docs.python.org/release/2.6/library/logging.html#configuring-logging-for-a-library +try: + from logging import NullHandler +except ImportError: + class NullHandler(logging.Handler): + def emit(self, record): + pass + TASK_LOGGER_NAME = 'aria.executions.task' http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d6458c03/aria/storage/core.py ---------------------------------------------------------------------- diff --git a/aria/storage/core.py b/aria/storage/core.py index 0e900bb..8caca66 100644 --- a/aria/storage/core.py +++ b/aria/storage/core.py @@ -37,9 +37,8 @@ API: * drivers - module, a pool of ARIA standard drivers. * StorageDriver - class, abstract model implementation. """ -import logging -from aria.logger import LoggerMixin +from aria.logger import LoggerMixin, NullHandler from . import sql_mapi __all__ = ( @@ -75,7 +74,7 @@ class Storage(LoggerMixin): # Set the logger handler of any storage object to NullHandler. # This is since the absence of a handler shows up while using the CLI in the form of: # `No handlers could be found for logger "aria.ResourceStorage"`. - self.logger.addHandler(logging.NullHandler()) + self.logger.addHandler(NullHandler()) self.api = api_cls self.registered = {} self._initiator = initiator