Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging #17064

Merged
merged 16 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/python/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gens/
*_pb2.py
*_pb2_grpc.py
*.egg-info/
2 changes: 1 addition & 1 deletion src/python/grpcio/grpc/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from grpc._cython import cygrpc
from grpc.framework.foundation import callable_util

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

_USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__)

Expand Down
2 changes: 1 addition & 1 deletion src/python/grpcio/grpc/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import grpc
from grpc._cython import cygrpc

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

CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = {
cygrpc.ConnectivityState.idle:
Expand Down
2 changes: 1 addition & 1 deletion src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import logging

logging.basicConfig()
_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.
Expand Down
2 changes: 1 addition & 1 deletion src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import logging
import time
import grpc

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

cdef class Server:

Expand Down
2 changes: 1 addition & 1 deletion src/python/grpcio/grpc/_plugin_wrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from grpc import _common
from grpc._cython import cygrpc

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


class _AuthMetadataContext(
Expand Down
1 change: 0 additions & 1 deletion src/python/grpcio/grpc/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
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,8 +21,8 @@

import six

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


class Outcome(six.with_metaclass(abc.ABCMeta)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

from concurrent import futures

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


def _wrap(behavior):
Expand Down
2 changes: 1 addition & 1 deletion src/python/grpcio/grpc/framework/foundation/stream_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from grpc.framework.foundation import stream

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


class TransformingConsumer(stream.Consumer):
Expand Down
2 changes: 1 addition & 1 deletion src/python/grpcio_tests/tests/interop/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from tests.interop import resources
from tests.unit import test_common

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


Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_tests/tests/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"unit._interceptor_test.InterceptorTest",
"unit._invalid_metadata_test.InvalidMetadataTest",
"unit._invocation_defects_test.InvocationDefectsTest",
"unit._logging_test.LoggingTest",
"unit._metadata_code_details_test.MetadataCodeDetailsTest",
"unit._metadata_test.MetadataTest",
"unit._reconnect_test.ReconnectTest",
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_tests/tests/unit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ GRPCIO_TESTS_UNIT = [
"_interceptor_test.py",
"_invalid_metadata_test.py",
"_invocation_defects_test.py",
"_logging_test.py",
"_metadata_code_details_test.py",
"_metadata_test.py",
# TODO: Issue 16336
Expand Down
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Test of gRPC Python's application-layer API."""

import unittest
import logging

import six

Expand Down Expand Up @@ -102,4 +103,5 @@ def test_secure_channel(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_auth_context_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import pickle
import unittest
import logging

import grpc
from grpc import _channel
Expand Down Expand Up @@ -187,4 +188,5 @@ def testSessionResumption(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_auth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import collections
import threading
import unittest
import logging

from grpc import _auth

Expand Down Expand Up @@ -77,4 +78,5 @@ def mock_callback(metadata, error):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_channel_args_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from concurrent import futures
import unittest
import logging

import grpc

Expand Down Expand Up @@ -62,4 +63,5 @@ def test_invalid_client_args(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_channel_close_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
"""Tests server and client side compression."""

import logging
import threading
import time
import unittest
Expand Down Expand Up @@ -182,4 +183,5 @@ def sleep_some_time_then_close():


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
"""Tests of grpc._channel.Channel connectivity."""

import logging
import threading
import time
import unittest
Expand Down Expand Up @@ -142,4 +143,5 @@ def test_reachable_then_unreachable_channel_connectivity(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import threading
import unittest
import logging

import grpc
from tests.unit.framework.common import test_constants
Expand Down Expand Up @@ -85,4 +86,5 @@ def test_immediately_connectable_channel_connectivity(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_compression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import unittest

import logging
import grpc
from grpc import _grpcio_metadata

Expand Down Expand Up @@ -117,4 +118,5 @@ def testStreaming(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_credentials_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Tests of credentials."""

import unittest
import logging

import grpc

Expand Down Expand Up @@ -54,4 +55,5 @@ def test_channel_credentials_composition(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_empty_message_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import unittest
import logging

import grpc

Expand Down Expand Up @@ -118,4 +119,5 @@ def testStreamStream(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_exit_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import argparse
import threading
import time
import logging

import grpc

Expand Down Expand Up @@ -161,6 +162,7 @@ def infinite_request_iterator():


if __name__ == '__main__':
logging.basicConfig()
parser = argparse.ArgumentParser()
parser.add_argument('scenario', type=str)
parser.add_argument(
Expand Down
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_exit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import threading
import time
import unittest
import logging

from tests.unit import _exit_scenarios

Expand Down Expand Up @@ -187,4 +188,5 @@ def test_in_flight_partial_stream_stream_call(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_interceptor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import itertools
import threading
import unittest
import logging
from concurrent import futures

import grpc
Expand Down Expand Up @@ -598,4 +599,5 @@ def testInterceptedStreamRequestStreamResponse(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
2 changes: 2 additions & 0 deletions src/python/grpcio_tests/tests/unit/_invalid_metadata_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Test of RPCs made against gRPC Python's application-layer API."""

import unittest
import logging

import grpc

Expand Down Expand Up @@ -131,4 +132,5 @@ def testStreamRequestStreamResponse(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import itertools
import threading
import unittest
import logging

import grpc

Expand Down Expand Up @@ -271,4 +272,5 @@ def testDefectiveGenericRpcHandlerUnaryResponse(self):


if __name__ == '__main__':
logging.basicConfig()
unittest.main(verbosity=2)