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

python: grpcio==1.16.0 adds a new logging handler for stderr #17135

Closed
attila123 opened this issue Nov 7, 2018 · 7 comments
Closed

python: grpcio==1.16.0 adds a new logging handler for stderr #17135

attila123 opened this issue Nov 7, 2018 · 7 comments

Comments

@attila123
Copy link

attila123 commented Nov 7, 2018

What version of gRPC and what language are you using?

grpcio==1.16.0, python

What operating system (Linux, Windows, …) and version?

Arch Linux (recent)

What runtime / compiler are you using (e.g. python version or version of gcc)

python 3.7.1
I installed grpcio via pip from pypi.

What did you do?

I ran my application as usual. After updating to grpcio==1.16.0 from grpcio==1.15.0 I see that my log lines were also output to stderr. I double checked it and it does not happen with 1.15.0.
My application currently uses the root logger (maybe not the best practice), creates a handler and uses
logging.root.addHandler() to add it to the root logger.

What did you expect to see?

That logging behaviour is not changed by updating grpcio.
Or at least it should have been documented (did not find anything about it in the changelog).
Please let me know how I can disable this gprcio adding this extra handler.
I thought I could iterate over the handlers of the root logger, trying to find this extra handler and remove it, but it would be an ugly workaround.

What did you see instead?

With pycharm I put a breakpoint in /usr/lib/python3.7/logging/__init__.py addHandler() (line 1535), and I can confirm that with grpcio==1.16.0 this addHandler() method is called from the grpcio library (see the attached screenshot). (Again, this does not happen with 1.15.0, I checked it.)
image
In the call stack it is also (somewhat) visible that it is triggered from grpc/__init__.py line 22 which does the following: from grpc._cython import cygrpc as _cygrpc and this is triggered when my application does import grpc.

Anything else we should know about your project / environment?

@attila123 attila123 changed the title python: grpcio==1.16.0 adds a new loggin handler for stderr python: grpcio==1.16.0 adds a new logging handler for stderr Nov 7, 2018
@srini100
Copy link
Contributor

srini100 commented Nov 7, 2018

@gnossen, can you please check if your PR #17091 resolves this issue?

@gnossen
Copy link
Contributor

gnossen commented Nov 7, 2018

This issue was resolved by #17064. A patch to 1.16 containing this fix is forthcoming.

@srini100
Copy link
Contributor

srini100 commented Nov 7, 2018

@attila123, 1.16.1rc1 with this fix is released. If no issues reported, expect the final release in about a week.

@attila123
Copy link
Author

@srini100 Thanks. I'm a bit busy (and lazy) to build it from source myself, so I will wait until a new version is published to pypi.

@srini100
Copy link
Contributor

srini100 commented Nov 7, 2018

@attila123, 1.16.1rc1 is published to pypi. You can just do pip install grpcio==1.16.1rc1

@attila123
Copy link
Author

@srini100 Thanks, maybe I overlooked something. Just tested with grpcio==1.16.1rc1, I can confirm that this issue is solved in that version.

@gnossen
Copy link
Contributor

gnossen commented Nov 15, 2018

Resolved by #17064. Released as 1.16.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants