googleapis / googleapis/google-cloud-java

[java-logging] LoggingOptions.getDefaultInstance() always returns a new object

未关闭
#11,922 5 条评论 0 个 reaction 已指派 1 人 已被 @cindy-peng 认领 在 GitHub 查看
api: logging next major: breaking change priority: p3 type: bug
主要语言
Java
星标
2.1k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
154

描述

`LoggingOptions.getDefaultInstance()` always returns a new object:

```java
public static LoggingOptions getDefaultInstance() {
return newBuilder().build();
}
```

This is very misleading, because the method name suggests it will return the same instance.

Consequences are that `Logging` instance is not shared among handlers etc. if we use `LoggingOptions.getDefaultInstance()` to pass the options, without saving them to a variable.

In fact, our codebase had `LoggingOptions.getDefaultInstance().service` in a few places, and a new client was always created as a result.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。