Skip to content

Commit

Permalink
Configure module level loggers with basicConfig()
Browse files Browse the repository at this point in the history
Module level loggers were introduced to gRPC Python in 06e1683, but
missed configuring these, leading to 'No handler found for module'
errors. Using the root logger implicitly calls basicConfig() which does
the basic configuration for the logging system by creating a
StreamHandler with a default Formatter and adding it to the logger. But
this is not the case for module level loggers.

Fix this issue by explicitly calling logging.basicConfig().
  • Loading branch information
ghostwriternr committed Aug 17, 2018
1 parent 0a1d0d2 commit a20e207
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/python/grpcio/grpc/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from grpc._cython import cygrpc
from grpc.framework.foundation import callable_util

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)

_USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__)
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio/grpc/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import grpc
from grpc._cython import cygrpc

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)

CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = {
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import logging

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)

# This function will ascii encode unicode string inputs if neccesary.
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import logging
import time
import grpc

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)

cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapper(
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio/grpc/_plugin_wrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from grpc import _common
from grpc._cython import cygrpc

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio/grpc/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from grpc._cython import cygrpc
from grpc.framework.foundation import callable_util

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)

_SHUTDOWN_TAG = 'shutdown'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import six

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from concurrent import futures

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio/grpc/framework/foundation/stream_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from grpc.framework.foundation import stream

_NO_VALUE = object()
logging.basicConfig()
_LOGGER = logging.getLogger(__name__)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import grpc

_NOT_YET_OBSERVED = object()
logging.basicConfig()
_LOGGER = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_testing/grpc_testing/_server/_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import grpc
from grpc_testing import _common

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_testing/grpc_testing/_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import grpc
import grpc_testing

logging.basicConfig()
_LOGGER = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_tests/tests/interop/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from tests.interop import resources
from tests.unit import test_common

logging.basicConfig()
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
_LOGGER = logging.getLogger(__name__)

Expand Down

0 comments on commit a20e207

Please sign in to comment.