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

core: change the mapping from ChannelLogLevel to java.util.logging.Level #8531

Merged
merged 1 commit into from Sep 22, 2021
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
4 changes: 2 additions & 2 deletions api/src/main/java/io/grpc/ChannelLogger.java
Expand Up @@ -36,8 +36,8 @@ public abstract class ChannelLogger {
* | ChannelLogger Level | Channelz Severity | Java Logger Level |
* +---------------------+-------------------+-------------------+
* | DEBUG | N/A | FINEST |
* | INFO | CT_INFO | FINEST |
* | WARNING | CT_WARNING | FINER |
* | INFO | CT_INFO | FINER |
* | WARNING | CT_WARNING | FINE |
* | ERROR | CT_ERROR | FINE |
* +---------------------+-------------------+-------------------+
* </pre>
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/io/grpc/internal/ChannelLoggerImpl.java
Expand Up @@ -97,8 +97,9 @@ private static Severity toTracerSeverity(ChannelLogLevel level) {
private static Level toJavaLogLevel(ChannelLogLevel level) {
switch (level) {
case ERROR:
return Level.FINE;
case WARNING:
return Level.FINE;
case INFO:
return Level.FINER;
default:
return Level.FINEST;
Expand Down
Expand Up @@ -100,7 +100,7 @@ public void logging() {
.setTimestampNanos(200)
.build();
assertThat(stats.channelTrace.events).containsExactly(event);
assertThat(logs).contains("FINER: " + logPrefix + "Warning message");
assertThat(logs).contains("FINE: " + logPrefix + "Warning message");

clock.forwardNanos(100);
logger.log(ChannelLogLevel.INFO, "Info message");
Expand All @@ -112,7 +112,7 @@ public void logging() {
.setTimestampNanos(300)
.build();
assertThat(stats.channelTrace.events).containsExactly(event);
assertThat(logs).contains("FINEST: " + logPrefix + "Info message");
assertThat(logs).contains("FINER: " + logPrefix + "Info message");

clock.forwardNanos(100);
logger.log(ChannelLogLevel.DEBUG, "Debug message");
Expand Down Expand Up @@ -154,7 +154,7 @@ public void formatLogging() {
.setTimestampNanos(200)
.build();
assertThat(stats.channelTrace.events).containsExactly(event);
assertThat(logs).contains("FINER: " + logPrefix + "Warning message foo, bar");
assertThat(logs).contains("FINE: " + logPrefix + "Warning message foo, bar");

clock.forwardNanos(100);
logger.log(ChannelLogLevel.INFO, "Info message {0}", "bar");
Expand All @@ -166,7 +166,7 @@ public void formatLogging() {
.setTimestampNanos(300)
.build();
assertThat(stats.channelTrace.events).containsExactly(event);
assertThat(logs).contains("FINEST: " + logPrefix + "Info message bar");
assertThat(logs).contains("FINER: " + logPrefix + "Info message bar");

clock.forwardNanos(100);
logger.log(ChannelLogLevel.DEBUG, "Debug message {0}", "foo");
Expand Down