googleapis / googleapis/google-cloud-java

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

Aperta
#11,922 5 commenti 0 reazioni 1 assegnatario Rivendicata da @cindy-peng Vedi su GitHub
api: logging next major: breaking change priority: p3 type: bug
Lingua principale
Java
Stelle
2.1k
Fork
1.2k
Merge medio
1g 23h
PR unite (30g)
154

Descrizione

`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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.