[Backport][v1.78.x][Python] Resolve absl::InitializeLog warning#41639
Merged
sergiitk merged 1 commit intogrpc:v1.78.xfrom Feb 17, 2026
Merged
[Backport][v1.78.x][Python] Resolve absl::InitializeLog warning#41639sergiitk merged 1 commit intogrpc:v1.78.xfrom
sergiitk merged 1 commit intogrpc:v1.78.xfrom
Conversation
Fixes grpc#38703 After Core recently changed its logging system to use absl logging, gRPC python users started seeing the warning log `WARNING: All log messages before absl::InitializeLog() is called are written to STDERR.` This issue especially affects users who are indirect users of the gRPC Python library too, such as Gemini API users. `absl::InitializeLog()` is a C++ library that cannot directly be called in the Python layer. It is hence added in the Cython layer at the time of initializing. The Python layer so far did not have a dependency on the absl library, hence this PR also adds an external dependency on `absl/log:initialize` Design gRFC for this: grpc/proposal#505 Closes grpc#39779 COPYBARA_INTEGRATE_REVIEW=grpc#39779 from sreenithi:absl_init_log_python 59eb1e5 PiperOrigin-RevId: 869586957
sergiitk
approved these changes
Feb 17, 2026
sergiitk
added a commit
to sergiitk/grpc
that referenced
this pull request
Feb 24, 2026
… warning (grpc#41639)" This reverts commit 7139801.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #39779 to v1.78.x.
Fixes #38703
After Core recently changed its logging system to use absl logging, gRPC python users started seeing the warning log
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR.This issue especially affects users who are indirect users of the gRPC Python library too, such as Gemini API users.
absl::InitializeLog()is a C++ library that cannot directly be called in the Python layer. It is hence added in the Cython layer at the time of initializing.The Python layer so far did not have a dependency on the absl library, hence this PR also adds an external dependency on
absl/log:initializeDesign gRFC for this: grpc/proposal#505
However, abseil-cpp currently doesn't allow
absl::InitializeLog()to be called more than once, and will result in an error like:The changes in this PR may hence cause problems to a small percentage of users with a custom build that's linking directly against gRPC Cython code, and then call absl::InitializeLog() (directly or transitively).
To solve this problem, this PR also introduces a new environment variable
GRPC_PYTHON_DISABLE_ABSL_INIT_LOGthat will allow users to opt-out of this automatic abseil log initialization when set.