aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
diff options
context:
space:
mode:
authorGravatar Naresh <ghostwriternr@gmail.com>2018-03-01 13:24:45 +0530
committerGravatar Naresh <ghostwriternr@gmail.com>2018-05-31 08:08:25 +0000
commit2e113ca6b2cc31aa8a9687d40ee1bd759381654f (patch)
tree1400589a34a636698e6ed175d5e83b4d7b593bb2 /src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
parentc4bc06be8b654accd19e58ef4f97a6ac3a480914 (diff)
Update logging in Python to use module-level logger
All logging in Python so far was done with the root logger, resulting in logs like: `ERROR:Exception calling application:`. With module-level loggers, the logs will instead include the module in which the exception is raised: `ERROR:grpc._server:Exception calling application:`
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi')
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
index 707ec742dd..da3dd21244 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
@@ -18,6 +18,8 @@ import logging
import time
import grpc
+_LOGGER = logging.getLogger(__name__)
+
cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapper(
void* user_data, grpc_ssl_server_certificate_config **config) with gil:
# This is a credentials.ServerCertificateConfig
@@ -34,13 +36,13 @@ cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapp
try:
cert_config_wrapper = user_cb()
except Exception:
- logging.exception('Error fetching certificate config')
+ _LOGGER.exception('Error fetching certificate config')
return GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL
if cert_config_wrapper is None:
return GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED
elif not isinstance(
cert_config_wrapper, grpc.ServerCertificateConfiguration):
- logging.error(
+ _LOGGER.error(
'Error fetching certificate configuration: certificate '
'configuration must be of type grpc.ServerCertificateConfiguration, '
'not %s' % type(cert_config_wrapper).__name__)