Skip to content

Commit e578604

Browse files
committed
Added logs for TlsXdsCredentialsProvider
1 parent 19d6b74 commit e578604

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

xds/src/main/java/io/grpc/xds/internal/TlsXdsCredentialsProvider.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
import java.io.File;
2424
import java.io.IOException;
2525
import java.util.Map;
26+
import java.util.logging.Level;
27+
import java.util.logging.Logger;
2628

2729
/**
2830
* A wrapper class that supports {@link TlsChannelCredentials} for Xds
2931
* by implementing {@link XdsCredentialsProvider}.
3032
*/
3133
public final class TlsXdsCredentialsProvider extends XdsCredentialsProvider {
34+
private static final Logger logger = Logger.getLogger(TlsXdsCredentialsProvider.class.getName());
3235
private static final String CREDS_NAME = "tls";
3336

3437
@Override
@@ -45,6 +48,7 @@ protected ChannelCredentials newChannelCredentials(Map<String, ?> jsonConfig) {
4548
try {
4649
builder.trustManager(new File(rootCertPath));
4750
} catch (IOException e) {
51+
logger.log(Level.WARNING, "Unable to read root certificates", e);
4852
return null;
4953
}
5054
}
@@ -57,9 +61,11 @@ protected ChannelCredentials newChannelCredentials(Map<String, ?> jsonConfig) {
5761
try {
5862
builder.keyManager(new File(certChainPath), new File(privateKeyPath));
5963
} catch (IOException e) {
64+
logger.log(Level.WARNING, "Unable to read certificate chain or private key", e);
6065
return null;
6166
}
6267
} else if (certChainPath != null || privateKeyPath != null) {
68+
logger.log(Level.WARNING, "Certificate chain and private key must be both set or unset");
6369
return null;
6470
}
6571

0 commit comments

Comments
 (0)