googleapis / googleapis/google-cloud-java

[sdk-platform-java] Wrap expensive log statements in isLoggable check

Offen
#12,467 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
priority: p2 type: cleanup
Vorherrschende Sprache
Java
Sterne
2.1k
Forks
1.2k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
154

Beschreibung

String manipulation that occurs before invoking the log method:
* https://github.com/googleapis/sdk-platform-java/blob/7fc555c20c642e813ee60fc27e05966143afc924/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/ChannelPool.java#L290-L301

And a method that performs relatively complex logic (env var checking, file reading) before choosing what to log:
* https://github.com/googleapis/sdk-platform-java/blob/7fc555c20c642e813ee60fc27e05966143afc924/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java#L275
* The first check in this method could check the log level and exit early if no logging will be performed.

A quick search of other log uses in sdk-platform-java and google-cloud-java did not show any other substantial improvements.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.