Skip navigation links

Package com.google.cloud.logging.v2

A client to Stackdriver Logging API.

See: Description

Package com.google.cloud.logging.v2 Description

A client to Stackdriver Logging API.

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

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

Service Description: Service for ingesting and querying logs.

Sample for LoggingClient:

 
 try (LoggingClient loggingClient = LoggingClient.create()) {
   LogName logName = ProjectLogName.of("[PROJECT]", "[LOG]");
   loggingClient.deleteLog(logName);
 }
 
 
============ ConfigClient ============

Service Description: Service for configuring sinks used to export log entries out of Logging.

Sample for ConfigClient:

 
 try (ConfigClient configClient = ConfigClient.create()) {
   SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
   LogSink response = configClient.getSink(sinkName);
 }
 
 
============= MetricsClient =============

Service Description: Service for configuring logs-based metrics.

Sample for MetricsClient:

 
 try (MetricsClient metricsClient = MetricsClient.create()) {
   MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]");
   LogMetric response = metricsClient.getLogMetric(metricName);
 }
 
 
Skip navigation links

Copyright © 2019 Google LLC. All rights reserved.