Skip to content

LoggingOptions.getDefaultInstance() always returns a new object #908

@alamothe

Description

@alamothe

LoggingOptions.getDefaultInstance() always returns a new object:

  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.

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/java-logging API.next major: breaking changethis is a change that we should wait to bundle into the next major versionpriority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions