googleapis / googleapis/google-cloud-java
[java-logging] LoggingOptions.getDefaultInstance() always returns a new object
未关闭
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 还没有评估数据。