googleapis / gax-java

This library has moved to https://github.com/googleapis/sdk-platform-java/tree/main/gax-java.
https://github.com/googleapis/gapic-generator-java/tree/main/gax-java
BSD 3-Clause "New" or "Revised" License
162 stars 119 forks source link

PropertiesProvider writes exceptions to System.err instead of a logger #282

Closed jradcliff closed 5 years ago

jradcliff commented 7 years ago

The new(ish) PropertiesProvider writes exceptions and other messages to System.err instead of using a logger. This creates a significant amount of noise for what appear to be non-critical errors.

For example, loadProperty invokes System.err.printStackTrace on line 81, but the return null after the catch suggests exceptions there are non-critical. By using a logger instead of System.err, users can suppress these messages if desired.

Example stderr output:

java.lang.NullPointerException
    at java.util.Properties$LineReader.readLine(Properties.java:434)
    at java.util.Properties.load0(Properties.java:353)
    at java.util.Properties.load(Properties.java:341)
    at com.google.api.gax.core.PropertiesProvider.loadProperty(PropertiesProvider.java:69)

Thanks

garrettjonesgoogle commented 7 years ago

Related issue in google-cloud-java: https://github.com/GoogleCloudPlatform/google-cloud-java/issues/1909

andreamlin commented 5 years ago

Looking at the current state of the gax-java codebase, it seems we don't use the System.err channel needlessly any more. Closing this out.