Package com.google.cloud.logging.v2


@Generated("by gapic-generator-java") package com.google.cloud.logging.v2
A client to Cloud Logging API

The interfaces provided are listed below, along with usage samples.

======================= LoggingClient =======================

Service Description: Service for ingesting and querying logs.

Sample for LoggingClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (LoggingClient loggingClient = LoggingClient.create()) {
   LogName logName = LogName.ofProjectLogName("[PROJECT]", "[LOG]");
   loggingClient.deleteLog(logName);
 }
 

======================= ConfigClient =======================

Service Description: Service for configuring sinks used to route log entries.

Sample for ConfigClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ConfigClient configClient = ConfigClient.create()) {
   GetBucketRequest request =
       GetBucketRequest.newBuilder()
           .setName(
               LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]")
                   .toString())
           .build();
   LogBucket response = configClient.getBucket(request);
 }
 

======================= MetricsClient =======================

Service Description: Service for configuring logs-based metrics.

Sample for MetricsClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (MetricsClient metricsClient = MetricsClient.create()) {
   LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
   LogMetric response = metricsClient.getLogMetric(metricName);
 }