Package com.google.cloud.logging (3.23.7)

GitHub Repository

Classes

ClassDescription
com.google.cloud.logging.ContextClass to hold context attributes including information about {@see HttpRequest} and tracing.
com.google.cloud.logging.Context.BuilderA builder for {@see Context} objects.
com.google.cloud.logging.ContextHandlerClass provides a per-thread storage of the {@see Context} instances.
com.google.cloud.logging.ExclusionSpecifies a set of log entries that are not to be stored in Logging. If your GCP resource receives a large volume of logs, you can use exclusions to reduce your chargeable logs. Exclusions are processed after log sinks, so you can export log entries before they are excluded. Note that organization-level and folder-level exclusions don't apply to child resources, and that
com.google.cloud.logging.Exclusion.BuilderA builder forExclusion objects.
com.google.cloud.logging.HttpRequestObjects of this class represent information about the (optional) HTTP request associated with a log entry.See Also: Http Request
com.google.cloud.logging.HttpRequest.BuilderA builder forHttpRequest objects.
com.google.cloud.logging.HttpRequest.RequestMethodThe HTTP request method.
com.google.cloud.logging.Instrumentation
com.google.cloud.logging.LogDestinationNameClass for specifying resource name of the log to which this log entry belongs (see 'logName' parameter inhttps://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry)
com.google.cloud.logging.LogEntryA Cloud Logging log entry. All log entries are represented via objects of this class. Log entries can have different type of payloads: an UTF-8 string (seePayload.StringPayload), a JSON object (seePayload.JsonPayload, or a protobuf object (seePayload.ProtoPayload). Entries can also store additional information about the operation or the HTTP request that
com.google.cloud.logging.LogEntry.BuilderA builder forLogEntry objects.
com.google.cloud.logging.LogEntryIteratorThe class implements {@see Iterator} interface over {@see LogEntry} by iterating through {@see TailLogEntriesResponse} streamed byBidiStream. This class is instantiated by {@see LogEntryServerStream} and is not intended to be used explicitly.
com.google.cloud.logging.LogEntryServerStreamThe class implementsIterable interface over {@see LogEntry}. It wraps aroundBidiStream bi-directional gRPC stream to support iterating through ingested responses. The class uses {@see LogEntryIterator} to iterate through the processed responses. The stream should be explicitly canceled by calling {@see LogEntryServerStream#cancel()} method. The class does not provide recovery or resuming functionality over the stream.
com.google.cloud.logging.Logging.EntryListOptionClass for specifying options for listing log entries.
com.google.cloud.logging.Logging.ListOptionClass for specifying options for listing sinks, monitored resources and monitored resource descriptors.
com.google.cloud.logging.Logging.TailOptionClass for specifying options for tailing log entries.
com.google.cloud.logging.Logging.WriteOptionClass for specifying options for writing log entries.
com.google.cloud.logging.LoggingHandlerA logging handler that outputs logs generated withjava.util.logging.Logger to Cloud Logging.

Java logging levels (seejava.util.logging.Level) are mapped to the following Google

com.google.cloud.logging.LoggingLevelThis class adds some additional Java logging levels for Cloud Logging. Added levels fill in the gap between Java logging levels and Cloud Logging severities.

Added levels in descending order are (between parenthesis the relation with Java logging

com.google.cloud.logging.LoggingOptions
com.google.cloud.logging.LoggingOptions.Builder
com.google.cloud.logging.LoggingOptions.DefaultLoggingFactory
com.google.cloud.logging.LoggingOptions.DefaultLoggingRpcFactory
com.google.cloud.logging.MetadataLoader
com.google.cloud.logging.MetricCloud Logging metrics describe logs-based metric. The value of the metric is the number of log entries that match a logs filter (see#getFilter()).

Metric adds a layer of service-related functionality overMetricInfo. Objects

com.google.cloud.logging.Metric.BuilderA builder forMetric objects.
com.google.cloud.logging.MetricInfoCloud Logging metrics describe logs-based metric. The value of the metric is the number of log entries that match a logs filter (see#getFilter()).See Also:Logs-based Metrics
com.google.cloud.logging.MetricInfo.BuilderA builder forMetricInfo objects.
com.google.cloud.logging.MonitoredResourceUtilMonitored resource construction utilities to detect resource type and add labels. Used by logging framework adapters to configure default resource. See usage inLoggingHandler.
com.google.cloud.logging.OperationAdditional information about a potentially long-running operation with which a log entry is associated.See Also: Log Entry Operation
com.google.cloud.logging.Operation.BuilderA builder forOperation objects.
com.google.cloud.logging.PayloadA base class for log entry payloads.See Also:Log Entries and Logs
com.google.cloud.logging.Payload.JsonPayloadA log entry's JSON payload.
com.google.cloud.logging.Payload.ProtoPayloadA log entry payload as a protobuf object.
com.google.cloud.logging.Payload.StringPayloadA log entry payload as an UTF-8 string.
com.google.cloud.logging.SinkCloud Logging sinks can be used to control the export of your logs. Each sink specifies the export of a set of log entries to a certain destination. A sink consists of a name, unique to the project, a filter for choosing the log entries to export and a destination for the log entries.
com.google.cloud.logging.Sink.BuilderA builder forSink objects.
com.google.cloud.logging.SinkInfoCloud Logging sinks can be used to control the export of your logs. Each sink specifies the export of a set of log entries to a certain destination. A sink consists of a name, unique to the project, a filter for choosing the log entries to export and a destination for the log entries.
com.google.cloud.logging.SinkInfo.BuilderA builder forSinkInfo objects.
com.google.cloud.logging.SinkInfo.Destination
com.google.cloud.logging.SinkInfo.Destination.BucketDestinationClass for specifying a Google Cloud Storage bucket as destination for the sink.
com.google.cloud.logging.SinkInfo.Destination.DatasetDestinationClass for specifying a Google Cloud BigQuery dataset as destination for the sink.
com.google.cloud.logging.SinkInfo.Destination.LoggingBucketDestination
com.google.cloud.logging.SinkInfo.Destination.TopicDestinationClass for specifying a Google Cloud BigQuery dataset as destination for the sink.
com.google.cloud.logging.SourceLocationAdditional information about the source code location that produced the log entry.
com.google.cloud.logging.SourceLocation.BuilderA builder forSourceLocation objects.
com.google.cloud.logging.TimestampDefaultFilter
com.google.cloud.logging.TraceLoggingEnhancer

Interfaces

InterfaceDescription
com.google.cloud.logging.ITimestampDefaultFilterEncapsulates implementation of default time filter. This is needed for testing since we can't mock static classes with EasyMock
com.google.cloud.logging.Logging
com.google.cloud.logging.LoggingEnhancerAn enhancer for log entries. Used to add custom labels to theLogEntry.Builder
com.google.cloud.logging.LoggingFactoryAn interface for Logging factories.
com.google.cloud.logging.ResourceTypeEnvironmentGetter

Enums

EnumDescription
com.google.cloud.logging.ContextHandler.ContextPriority
com.google.cloud.logging.LogDestinationName.DestinationType
com.google.cloud.logging.Logging.SortingFieldFields according to which log entries can be sorted.
com.google.cloud.logging.Logging.SortingOrderSorting orders available when listing log entries.
com.google.cloud.logging.LoggingHandler.LogTargetWhere to send logs.
com.google.cloud.logging.MonitoredResourceUtil.Label
com.google.cloud.logging.Payload.TypeType for a log entry payload.
com.google.cloud.logging.SeverityThe severity of the event described in a log entry. These guideline severity levels are ordered, with numerically smaller levels treated as less severe than numerically larger levels. If the source of the log entries uses a different set of severity levels, the client should select the closest correspondingSeverity value.
com.google.cloud.logging.SinkInfo.Destination.TypeType of destination for Cloud Logging sink.
com.google.cloud.logging.SinkInfo.VersionFormatAvailable log entry formats. Log entries can be written to Cloud Logging in either format and can be exported in either format. Version 2 is the preferred format.
com.google.cloud.logging.SynchronicityUsed to specify the behavior of write calls to the Cloud Logging service. Specifying SYNC will make synchronous calls; specifying ASYNC will make asynchronous calls. The default behavior is ASYNC.

Exceptions

ExceptionDescription
com.google.cloud.logging.LoggingExceptionLogging service exception.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.