aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Richard Belleville <rbellevi@google.com>2018-10-30 18:16:53 -0700
committerGravatar Richard Belleville <rbellevi@google.com>2018-10-30 18:16:53 -0700
commit839722adc50ca6b2759805e30c6b8a4556652ff5 (patch)
treeac7a54e7735233960859f9124495d1655fb58ccb
parent1e05d48d2deac8486c9552a384a14848db09d558 (diff)
Add NullHandler to avoid warnings about no handler
-rw-r--r--src/python/grpcio/grpc/_channel.py1
-rw-r--r--src/python/grpcio/grpc/_common.py1
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi1
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi1
-rw-r--r--src/python/grpcio/grpc/_plugin_wrapping.py1
-rw-r--r--src/python/grpcio/grpc/framework/foundation/callable_util.py1
-rw-r--r--src/python/grpcio/grpc/framework/foundation/logging_pool.py1
-rw-r--r--src/python/grpcio/grpc/framework/foundation/stream_util.py1
-rw-r--r--src/python/grpcio_tests/tests/unit/_logging_test.py1
9 files changed, 9 insertions, 0 deletions
diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py
index c625cd3e37..a65ddfcd82 100644
--- a/src/python/grpcio/grpc/_channel.py
+++ b/src/python/grpcio/grpc/_channel.py
@@ -25,6 +25,7 @@ from grpc._cython import cygrpc
from grpc.framework.foundation import callable_util
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(logging.NullHandler)
_USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__)
diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py
index 8358cbec5b..d35f4566bd 100644
--- a/src/python/grpcio/grpc/_common.py
+++ b/src/python/grpcio/grpc/_common.py
@@ -21,6 +21,7 @@ import grpc
from grpc._cython import cygrpc
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(logging.NullHandler())
CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = {
cygrpc.ConnectivityState.idle:
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
index 00a1b23a67..fa356d913e 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
@@ -15,6 +15,7 @@
import logging
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(logging.NullHandler())
# This function will ascii encode unicode string inputs if neccesary.
# In Python3, unicode strings are the default str type.
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
index ce701724fd..f9d1e863ca 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
@@ -19,6 +19,7 @@ import time
import grpc
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(logging.NullHandler())
cdef class Server:
diff --git a/src/python/grpcio/grpc/_plugin_wrapping.py b/src/python/grpcio/grpc/_plugin_wrapping.py
index 916ee080b6..53af2ff913 100644
--- a/src/python/grpcio/grpc/_plugin_wrapping.py
+++ b/src/python/grpcio/grpc/_plugin_wrapping.py
@@ -21,6 +21,7 @@ from grpc import _common
from grpc._cython import cygrpc
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(logging.NullHandler())
class _AuthMetadataContext(
diff --git a/src/python/grpcio/grpc/framework/foundation/callable_util.py b/src/python/grpcio/grpc/framework/foundation/callable_util.py
index 24daf3406f..36066e19df 100644
--- a/src/python/grpcio/grpc/framework/foundation/callable_util.py
+++ b/src/python/grpcio/grpc/framework/foundation/callable_util.py
@@ -22,6 +22,7 @@ import logging
import six
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(logging.NullHandler())
class Outcome(six.with_metaclass(abc.ABCMeta)):
diff --git a/src/python/grpcio/grpc/framework/foundation/logging_pool.py b/src/python/grpcio/grpc/framework/foundation/logging_pool.py
index 216e3990db..dfb8dbdc30 100644
--- a/src/python/grpcio/grpc/framework/foundation/logging_pool.py
+++ b/src/python/grpcio/grpc/framework/foundation/logging_pool.py
@@ -18,6 +18,7 @@ import logging
from concurrent import futures
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(logging.NullHandler())
def _wrap(behavior):
diff --git a/src/python/grpcio/grpc/framework/foundation/stream_util.py b/src/python/grpcio/grpc/framework/foundation/stream_util.py
index 1faaf29bd7..df8c93d3e5 100644
--- a/src/python/grpcio/grpc/framework/foundation/stream_util.py
+++ b/src/python/grpcio/grpc/framework/foundation/stream_util.py
@@ -20,6 +20,7 @@ from grpc.framework.foundation import stream
_NO_VALUE = object()
_LOGGER = logging.getLogger(__name__)
+_LOGGER.addHandler(NullHandler())
class TransformingConsumer(stream.Consumer):
diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py
index 263a967025..dcafd38878 100644
--- a/src/python/grpcio_tests/tests/unit/_logging_test.py
+++ b/src/python/grpcio_tests/tests/unit/_logging_test.py
@@ -19,6 +19,7 @@ import grpc
import logging
class LoggingTest(unittest.TestCase):
+
def test_logger_not_occupied(self):
self.assertEqual(0, len(logging.getLogger().handlers))