1

如何设置 GCP 应用程序名称?

2018-Nov-22 11:18:18.283 WARN  [http-nio-8080-exec-9] 
c.g.a.c.g.s.AbstractGoogleClient - Application name is not set. 
Call 
Builder#setApplicationName.

我的班级中有以下构造函数。

private final GoogleCredential googleCredential;
private final String projectId;
private final String zone;
private final String region;

private GcpClient(GcpAccountSettings settings) throws 
  GcpClientException {
    try {
        this.googleCredential = 
  getCredential(settings.getClientEmail(), 
  settings.getPrivateKey());
    } catch (GeneralSecurityException | IOException e) {
        throw new GcpClientException(e);
    }

    this.projectId = settings.getProjectId();
    this.zone = settings.getZone();
    this.region = settings.getRegions();
}

我真的希望你的帮助。

4

1 回答 1

0

我们可以像下面这样设置应用程序名称。

 Compute compute =
            new Compute.Builder(googleCredential.getTransport(), 
 googleCredential.getJsonFactory(), googleCredential)
                    .setApplicationName(projectId).build();

如果您需要更多详细信息,请点击以下链接 如何设置应用程序名称

于 2018-11-22T05:45:24.213 回答