Merge pull request #17143 from grpc/module-root-logger

Only Add NullHandler to Module-Root Logger
pull/17189/head
Richard Belleville 6 years ago committed by GitHub
commit 27bab0c631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/python/grpcio/grpc/__init__.py
  2. 1
      src/python/grpcio/grpc/_channel.py
  3. 1
      src/python/grpcio/grpc/_common.py
  4. 1
      src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
  5. 1
      src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
  6. 1
      src/python/grpcio/grpc/_plugin_wrapping.py
  7. 1
      src/python/grpcio/grpc/framework/foundation/callable_util.py
  8. 1
      src/python/grpcio/grpc/framework/foundation/logging_pool.py
  9. 1
      src/python/grpcio/grpc/framework/foundation/stream_util.py
  10. 7
      src/python/grpcio_tests/tests/unit/_logging_test.py

@ -15,12 +15,14 @@
import abc
import enum
import logging
import sys
import six
from grpc._cython import cygrpc as _cygrpc
logging.getLogger(__name__).addHandler(logging.NullHandler())
############################## Future Interface ###############################

@ -25,7 +25,6 @@ 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__)

@ -21,7 +21,6 @@ import grpc
from grpc._cython import cygrpc
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = {
cygrpc.ConnectivityState.idle:

@ -15,7 +15,6 @@
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.

@ -19,7 +19,6 @@ import time
import grpc
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
cdef class Server:

@ -21,7 +21,6 @@ from grpc import _common
from grpc._cython import cygrpc
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
class _AuthMetadataContext(

@ -22,7 +22,6 @@ import logging
import six
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
class Outcome(six.with_metaclass(abc.ABCMeta)):

@ -18,7 +18,6 @@ import logging
from concurrent import futures
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
def _wrap(behavior):

@ -20,7 +20,6 @@ from grpc.framework.foundation import stream
_NO_VALUE = object()
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
class TransformingConsumer(stream.Consumer):

@ -68,6 +68,13 @@ class LoggingTest(unittest.TestCase):
self.assertEqual(1, len(logging.getLogger().handlers))
self.assertIs(logging.getLogger().handlers[0].stream, intended_stream)
@isolated_logging
def test_grpc_logger(self):
self.assertIn("grpc", logging.Logger.manager.loggerDict)
root_logger = logging.getLogger("grpc")
self.assertEqual(1, len(root_logger.handlers))
self.assertIsInstance(root_logger.handlers[0], logging.NullHandler)
if __name__ == '__main__':
unittest.main(verbosity=2)

Loading…
Cancel
Save