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

L117: C-core: replace gpr logging with absl logging #425

Merged
merged 26 commits into from May 17, 2024
Merged
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f730a07
gRFC for gpr logging to absl logging
tanvi-jagtap Apr 17, 2024
4c5a3ad
Fixing typo
tanvi-jagtap Apr 17, 2024
f05ebe0
Fixing typo
tanvi-jagtap Apr 17, 2024
5bc4021
Fixing the links
tanvi-jagtap Apr 17, 2024
d942b49
Adding details about verbosity
tanvi-jagtap Apr 19, 2024
4f85d1b
Adding proposed behaviour
tanvi-jagtap Apr 19, 2024
f61ba63
Rename L115-replacing-gpr-logging-with-abseil-logging.md to L116-repl…
tanvi-jagtap Apr 24, 2024
09a2281
Rename L116-replacing-gpr-logging-with-abseil-logging.md to L116-cpp-…
tanvi-jagtap Apr 25, 2024
3cc42fc
Update L116-cpp-replacing-gpr-logging-with-abseil-logging.md
tanvi-jagtap Apr 25, 2024
55a71a4
Rename L116-cpp-replacing-gpr-logging-with-abseil-logging.md to L117-…
tanvi-jagtap Apr 29, 2024
3eaca82
Update L117-cpp-replacing-gpr-logging-with-abseil-logging.md
tanvi-jagtap Apr 29, 2024
5280e29
Update L117-cpp-replacing-gpr-logging-with-abseil-logging.md
tanvi-jagtap Apr 29, 2024
54444c6
Update L117-cpp-replacing-gpr-logging-with-abseil-logging.md
tanvi-jagtap Apr 29, 2024
b188df3
Update L117-cpp-replacing-gpr-logging-with-abseil-logging.md
tanvi-jagtap Apr 29, 2024
517c373
Update L117-cpp-replacing-gpr-logging-with-abseil-logging.md
tanvi-jagtap Apr 29, 2024
e2aba84
Fixed half the review comments
tanvi-jagtap May 6, 2024
ffa0b8d
Rename L117-cpp-replacing-gpr-logging-with-abseil-logging.md to L117-…
tanvi-jagtap May 6, 2024
9a3e553
Fixed 1 review comment
tanvi-jagtap May 6, 2024
330f69d
Edit rationale section
tanvi-jagtap May 7, 2024
c8a4e8a
Edit rationale section
tanvi-jagtap May 7, 2024
4a397af
Fixing typo
tanvi-jagtap May 11, 2024
607f1dc
Update L117-core-replace-gpr-logging-with-abseil-logging.md
tanvi-jagtap May 13, 2024
8027216
Update L117-core-replace-gpr-logging-with-abseil-logging.md
tanvi-jagtap May 13, 2024
bb0db9f
Update L117-core-replace-gpr-logging-with-abseil-logging.md
tanvi-jagtap May 16, 2024
5bf0223
Update L117-core-replace-gpr-logging-with-abseil-logging.md
tanvi-jagtap May 16, 2024
4198fc1
Update L117-core-replace-gpr-logging-with-abseil-logging.md
tanvi-jagtap May 16, 2024
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
19 changes: 16 additions & 3 deletions L117-core-replace-gpr-logging-with-abseil-logging.md
Expand Up @@ -5,18 +5,19 @@ L117: C-core: Replace gpr Logging with absl Logging
* Approver: @markdroth , @ctiller
* Status: In Review
* Implemented in: gRPC C++
* Last updated: 2024-05-06.
* Last updated: 2024-05-07.
* Discussion at: https://groups.google.com/g/grpc-io/c/Jg7bvHqAyCU

## Abstract

Replacing gpr logging and asserts with Abseil logging and asserts

## Background & Rationale
## Background

gRPC is currently maintaining its own version of the logging and assert APIs. The Abseil library released their logs and asserts too. We want to leverage the Abseil library and avoid maintaining our own logging code. Also, the current implementation of gpr_log uses format strings which are not type safe and have exploit potential. Moving to absl logging will eliminate this security risk.

### References

* [gpr logging header](https://github.com/grpc/grpc/blame/83a17ff4684dc1fb3493a151ac0b655b1c55e766/include/grpc/support/log.h)
* [absl logging header](https://github.com/abseil/abseil-cpp/blob/master/absl/log/log.h)
* [absl assert header](https://github.com/abseil/abseil-cpp/blob/master/absl/log/check.h)
Expand Down Expand Up @@ -91,8 +92,20 @@ void gpr_set_log_verbosity(gpr_log_severity verbosity) {
}
```

## Implementation
## Rationale

### Advantages

* Format specifiers are not type-safe. We want to avoid these.
* We want to avoid maintaining platform specific gpr APIS when absl is providing them.
tanvi-jagtap marked this conversation as resolved.
Show resolved Hide resolved
* Abseil provides a range of APIs such as PLOG, VLOG, DVLOG with specific logging frequencies such as LOG_IF, LOG_EVERY_N, LOG_EVERY_POW_2 etc.

### Action Items

* Coding using the above APIs will need to migrate to the newer APIs.
* The application will need to call absl::InitializeLog() itself, or else there will be a log message indicating that logging is happening before absl logging is initialized. If in the future absl fixes [#1656](https://github.com/abseil/abseil-cpp/issues/1656), then we could consider initializing absl logging in gRPC init.

## Implementation

* [GPR_ASSERT and GPR_DEBUG_ASSERT removal](https://github.com/grpc/grpc/pulls?q=%22%5Bgrpc%5D%5BGpr_To_Absl_Logging%5D+Migrating+from+gpr+to+absl+logging+GPR_ASSERT%22+)
* [gpr_log removal](https://github.com/grpc/grpc/pulls?q=%22%5Bgrpc%5D%5BGpr_To_Absl_Logging%5D+Migrating+from+gpr+to+absl+logging+-+gpr_log%22+)