├── .cloudbuild └── samples_build.yaml ├── .github ├── .OwlBot-hermetic.yaml ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── support_request.md ├── PULL_REQUEST_TEMPLATE.md ├── auto-label.yaml ├── blunderbuss.yml ├── dependabot.yml ├── generated-files-bot.yml ├── release-please.yml ├── release-trigger.yml ├── scripts │ └── update_generation_config.sh ├── snippet-bot.yml ├── sync-repo-settings.yaml ├── trusted-contribution.yml └── workflows │ ├── approve-readme.yaml │ ├── auto-release.yaml │ ├── ci.yaml │ ├── hermetic_library_generation.yaml │ ├── renovate_config_check.yaml │ ├── samples.yaml │ ├── unmanaged_dependency_check.yaml │ └── update_generation_config.yaml ├── .gitignore ├── .gitmodules ├── .kokoro ├── build.bat ├── build.sh ├── coerce_logs.sh ├── common.cfg ├── common.sh ├── common_env_vars.cfg ├── continuous │ ├── common.cfg │ ├── java8.cfg │ └── propose_release.sh ├── dependencies.sh ├── environment │ ├── appengine_flex │ │ ├── common.cfg │ │ ├── continuous.cfg │ │ └── presubmit.cfg │ ├── appengine_standard │ │ ├── common.cfg │ │ ├── continuous.cfg │ │ └── presubmit.cfg │ ├── cloudrun │ │ ├── common.cfg │ │ ├── continuous.cfg │ │ └── presubmit.cfg │ ├── compute │ │ ├── common.cfg │ │ ├── continuous.cfg │ │ └── presubmit.cfg │ ├── functions │ │ ├── common.cfg │ │ ├── continuous.cfg │ │ └── presubmit.cfg │ └── kubernetes │ │ ├── common.cfg │ │ ├── continuous.cfg │ │ └── presubmit.cfg ├── environment_tests.sh ├── nightly │ ├── common.cfg │ ├── integration.cfg │ ├── java11-integration.cfg │ ├── java11.cfg │ ├── java7.cfg │ ├── java8-osx.cfg │ ├── java8-win.cfg │ ├── java8.cfg │ └── samples.cfg ├── populate-secrets.sh ├── presubmit │ ├── clirr.cfg │ ├── common.cfg │ ├── dependencies.cfg │ ├── graalvm-native-a.cfg │ ├── graalvm-native-b.cfg │ ├── graalvm-native-c.cfg │ ├── integration.cfg │ ├── java11.cfg │ ├── java7.cfg │ ├── java8-osx.cfg │ ├── java8-win.cfg │ ├── java8.cfg │ ├── linkage-monitor.cfg │ ├── lint.cfg │ └── samples.cfg ├── readme.sh └── trampoline.sh ├── .readme-partials.yaml ├── .repo-metadata.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── _static └── guide-me.svg ├── codecov.yaml ├── generation_config.yaml ├── google-cloud-logging-bom └── pom.xml ├── google-cloud-logging ├── clirr-ignored-differences.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── cloud │ │ │ └── logging │ │ │ ├── Context.java │ │ │ ├── ContextHandler.java │ │ │ ├── Exclusion.java │ │ │ ├── HttpRequest.java │ │ │ ├── ITimestampDefaultFilter.java │ │ │ ├── Instrumentation.java │ │ │ ├── JavaTimeConversions.java │ │ │ ├── LogDestinationName.java │ │ │ ├── LogEntry.java │ │ │ ├── LogEntryIterator.java │ │ │ ├── LogEntryServerStream.java │ │ │ ├── Logging.java │ │ │ ├── LoggingConfig.java │ │ │ ├── LoggingEnhancer.java │ │ │ ├── LoggingException.java │ │ │ ├── LoggingFactory.java │ │ │ ├── LoggingHandler.java │ │ │ ├── LoggingImpl.java │ │ │ ├── LoggingLevel.java │ │ │ ├── LoggingOptions.java │ │ │ ├── MetadataLoader.java │ │ │ ├── Metric.java │ │ │ ├── MetricInfo.java │ │ │ ├── MonitoredResourceUtil.java │ │ │ ├── Operation.java │ │ │ ├── Option.java │ │ │ ├── Payload.java │ │ │ ├── ResourceTypeEnvironmentGetter.java │ │ │ ├── ResourceTypeEnvironmentGetterImpl.java │ │ │ ├── Severity.java │ │ │ ├── Sink.java │ │ │ ├── SinkInfo.java │ │ │ ├── SourceLocation.java │ │ │ ├── Synchronicity.java │ │ │ ├── TimestampDefaultFilter.java │ │ │ ├── TraceLoggingEnhancer.java │ │ │ ├── package-info.java │ │ │ ├── spi │ │ │ ├── LoggingRpcFactory.java │ │ │ └── v2 │ │ │ │ ├── GrpcLoggingRpc.java │ │ │ │ └── LoggingRpc.java │ │ │ ├── testing │ │ │ ├── RemoteLoggingHelper.java │ │ │ └── package-info.java │ │ │ └── v2 │ │ │ ├── ConfigClient.java │ │ │ ├── ConfigSettings.java │ │ │ ├── LoggingClient.java │ │ │ ├── LoggingSettings.java │ │ │ ├── MetricsClient.java │ │ │ ├── MetricsSettings.java │ │ │ ├── gapic_metadata.json │ │ │ ├── package-info.java │ │ │ └── stub │ │ │ ├── ConfigServiceV2Stub.java │ │ │ ├── ConfigServiceV2StubSettings.java │ │ │ ├── GrpcConfigServiceV2CallableFactory.java │ │ │ ├── GrpcConfigServiceV2Stub.java │ │ │ ├── GrpcLoggingServiceV2CallableFactory.java │ │ │ ├── GrpcLoggingServiceV2Stub.java │ │ │ ├── GrpcMetricsServiceV2CallableFactory.java │ │ │ ├── GrpcMetricsServiceV2Stub.java │ │ │ ├── LoggingServiceV2Stub.java │ │ │ ├── LoggingServiceV2StubSettings.java │ │ │ ├── MetricsServiceV2Stub.java │ │ │ └── MetricsServiceV2StubSettings.java │ └── resources │ │ └── META-INF │ │ └── native-image │ │ └── com.google.cloud.logging.v2 │ │ └── reflect-config.json │ └── test │ ├── java │ └── com │ │ └── google │ │ └── cloud │ │ └── logging │ │ ├── AutoPopulateMetadataTests.java │ │ ├── BaseSystemTest.java │ │ ├── ContextHandlerTest.java │ │ ├── ContextTest.java │ │ ├── ExclusionTest.java │ │ ├── HttpRequestTest.java │ │ ├── InstrumentationTest.java │ │ ├── InvalidContextTest.java │ │ ├── LogEntryTest.java │ │ ├── LoggingHandlerTest.java │ │ ├── LoggingImplTest.java │ │ ├── LoggingLevelTest.java │ │ ├── LoggingOptionsTest.java │ │ ├── LoggingTest.java │ │ ├── MetricInfoTest.java │ │ ├── MetricTest.java │ │ ├── MonitoredResourceUtilTest.java │ │ ├── OperationTest.java │ │ ├── OptionTest.java │ │ ├── PayloadTest.java │ │ ├── SerializationTest.java │ │ ├── SinkInfoTest.java │ │ ├── SinkTest.java │ │ ├── SourceLocationTest.java │ │ ├── TailLogEntriesTest.java │ │ ├── TimestampDefaultFilterTest.java │ │ ├── it │ │ ├── ITJulLoggerTest.java │ │ ├── ITLoggingTest.java │ │ ├── ITMetricsTest.java │ │ ├── ITSinkTest.java │ │ ├── ITTailLogsTest.java │ │ └── ITTracingLogsTest.java │ │ └── v2 │ │ ├── ConfigClientTest.java │ │ ├── LoggingClientTest.java │ │ ├── MetricsClientTest.java │ │ ├── MockConfigServiceV2.java │ │ ├── MockConfigServiceV2Impl.java │ │ ├── MockLoggingServiceV2.java │ │ ├── MockLoggingServiceV2Impl.java │ │ ├── MockMetricsServiceV2.java │ │ ├── MockMetricsServiceV2Impl.java │ │ └── testing │ │ ├── LocalLoggingHelper.java │ │ └── LocalLoggingImpl.java │ └── resources │ └── META-INF │ └── native-image │ └── com.google.cloud │ └── google-cloud-logging │ └── native-image.properties ├── grpc-google-cloud-logging-v2 ├── clirr-ignored-differences.xml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── google │ └── logging │ └── v2 │ ├── ConfigServiceV2Grpc.java │ ├── LoggingServiceV2Grpc.java │ └── MetricsServiceV2Grpc.java ├── java.header ├── license-checks.xml ├── owlbot.py ├── pom.xml ├── proto-google-cloud-logging-v2 ├── clirr-ignored-differences.xml ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── google │ │ └── logging │ │ └── v2 │ │ ├── BigQueryDataset.java │ │ ├── BigQueryDatasetOrBuilder.java │ │ ├── BigQueryOptions.java │ │ ├── BigQueryOptionsOrBuilder.java │ │ ├── BillingAccountLocationName.java │ │ ├── BillingAccountName.java │ │ ├── BucketMetadata.java │ │ ├── BucketMetadataOrBuilder.java │ │ ├── CmekSettings.java │ │ ├── CmekSettingsName.java │ │ ├── CmekSettingsOrBuilder.java │ │ ├── CopyLogEntriesMetadata.java │ │ ├── CopyLogEntriesMetadataOrBuilder.java │ │ ├── CopyLogEntriesRequest.java │ │ ├── CopyLogEntriesRequestOrBuilder.java │ │ ├── CopyLogEntriesResponse.java │ │ ├── CopyLogEntriesResponseOrBuilder.java │ │ ├── CreateBucketRequest.java │ │ ├── CreateBucketRequestOrBuilder.java │ │ ├── CreateExclusionRequest.java │ │ ├── CreateExclusionRequestOrBuilder.java │ │ ├── CreateLinkRequest.java │ │ ├── CreateLinkRequestOrBuilder.java │ │ ├── CreateLogMetricRequest.java │ │ ├── CreateLogMetricRequestOrBuilder.java │ │ ├── CreateSinkRequest.java │ │ ├── CreateSinkRequestOrBuilder.java │ │ ├── CreateViewRequest.java │ │ ├── CreateViewRequestOrBuilder.java │ │ ├── DeleteBucketRequest.java │ │ ├── DeleteBucketRequestOrBuilder.java │ │ ├── DeleteExclusionRequest.java │ │ ├── DeleteExclusionRequestOrBuilder.java │ │ ├── DeleteLinkRequest.java │ │ ├── DeleteLinkRequestOrBuilder.java │ │ ├── DeleteLogMetricRequest.java │ │ ├── DeleteLogMetricRequestOrBuilder.java │ │ ├── DeleteLogRequest.java │ │ ├── DeleteLogRequestOrBuilder.java │ │ ├── DeleteSinkRequest.java │ │ ├── DeleteSinkRequestOrBuilder.java │ │ ├── DeleteViewRequest.java │ │ ├── DeleteViewRequestOrBuilder.java │ │ ├── FolderLocationName.java │ │ ├── FolderName.java │ │ ├── GetBucketRequest.java │ │ ├── GetBucketRequestOrBuilder.java │ │ ├── GetCmekSettingsRequest.java │ │ ├── GetCmekSettingsRequestOrBuilder.java │ │ ├── GetExclusionRequest.java │ │ ├── GetExclusionRequestOrBuilder.java │ │ ├── GetLinkRequest.java │ │ ├── GetLinkRequestOrBuilder.java │ │ ├── GetLogMetricRequest.java │ │ ├── GetLogMetricRequestOrBuilder.java │ │ ├── GetSettingsRequest.java │ │ ├── GetSettingsRequestOrBuilder.java │ │ ├── GetSinkRequest.java │ │ ├── GetSinkRequestOrBuilder.java │ │ ├── GetViewRequest.java │ │ ├── GetViewRequestOrBuilder.java │ │ ├── IndexConfig.java │ │ ├── IndexConfigOrBuilder.java │ │ ├── IndexType.java │ │ ├── LifecycleState.java │ │ ├── Link.java │ │ ├── LinkMetadata.java │ │ ├── LinkMetadataOrBuilder.java │ │ ├── LinkName.java │ │ ├── LinkOrBuilder.java │ │ ├── ListBucketsRequest.java │ │ ├── ListBucketsRequestOrBuilder.java │ │ ├── ListBucketsResponse.java │ │ ├── ListBucketsResponseOrBuilder.java │ │ ├── ListExclusionsRequest.java │ │ ├── ListExclusionsRequestOrBuilder.java │ │ ├── ListExclusionsResponse.java │ │ ├── ListExclusionsResponseOrBuilder.java │ │ ├── ListLinksRequest.java │ │ ├── ListLinksRequestOrBuilder.java │ │ ├── ListLinksResponse.java │ │ ├── ListLinksResponseOrBuilder.java │ │ ├── ListLogEntriesRequest.java │ │ ├── ListLogEntriesRequestOrBuilder.java │ │ ├── ListLogEntriesResponse.java │ │ ├── ListLogEntriesResponseOrBuilder.java │ │ ├── ListLogMetricsRequest.java │ │ ├── ListLogMetricsRequestOrBuilder.java │ │ ├── ListLogMetricsResponse.java │ │ ├── ListLogMetricsResponseOrBuilder.java │ │ ├── ListLogsRequest.java │ │ ├── ListLogsRequestOrBuilder.java │ │ ├── ListLogsResponse.java │ │ ├── ListLogsResponseOrBuilder.java │ │ ├── ListMonitoredResourceDescriptorsRequest.java │ │ ├── ListMonitoredResourceDescriptorsRequestOrBuilder.java │ │ ├── ListMonitoredResourceDescriptorsResponse.java │ │ ├── ListMonitoredResourceDescriptorsResponseOrBuilder.java │ │ ├── ListSinksRequest.java │ │ ├── ListSinksRequestOrBuilder.java │ │ ├── ListSinksResponse.java │ │ ├── ListSinksResponseOrBuilder.java │ │ ├── ListViewsRequest.java │ │ ├── ListViewsRequestOrBuilder.java │ │ ├── ListViewsResponse.java │ │ ├── ListViewsResponseOrBuilder.java │ │ ├── LocationMetadata.java │ │ ├── LocationMetadataOrBuilder.java │ │ ├── LocationName.java │ │ ├── LogBucket.java │ │ ├── LogBucketName.java │ │ ├── LogBucketOrBuilder.java │ │ ├── LogEntry.java │ │ ├── LogEntryOperation.java │ │ ├── LogEntryOperationOrBuilder.java │ │ ├── LogEntryOrBuilder.java │ │ ├── LogEntryProto.java │ │ ├── LogEntrySourceLocation.java │ │ ├── LogEntrySourceLocationOrBuilder.java │ │ ├── LogExclusion.java │ │ ├── LogExclusionName.java │ │ ├── LogExclusionOrBuilder.java │ │ ├── LogMetric.java │ │ ├── LogMetricName.java │ │ ├── LogMetricOrBuilder.java │ │ ├── LogName.java │ │ ├── LogSink.java │ │ ├── LogSinkName.java │ │ ├── LogSinkOrBuilder.java │ │ ├── LogSplit.java │ │ ├── LogSplitOrBuilder.java │ │ ├── LogView.java │ │ ├── LogViewName.java │ │ ├── LogViewOrBuilder.java │ │ ├── LoggingConfigProto.java │ │ ├── LoggingMetricsProto.java │ │ ├── LoggingProto.java │ │ ├── OperationState.java │ │ ├── OrganizationLocationName.java │ │ ├── OrganizationName.java │ │ ├── ProjectName.java │ │ ├── Settings.java │ │ ├── SettingsName.java │ │ ├── SettingsOrBuilder.java │ │ ├── TailLogEntriesRequest.java │ │ ├── TailLogEntriesRequestOrBuilder.java │ │ ├── TailLogEntriesResponse.java │ │ ├── TailLogEntriesResponseOrBuilder.java │ │ ├── UndeleteBucketRequest.java │ │ ├── UndeleteBucketRequestOrBuilder.java │ │ ├── UpdateBucketRequest.java │ │ ├── UpdateBucketRequestOrBuilder.java │ │ ├── UpdateCmekSettingsRequest.java │ │ ├── UpdateCmekSettingsRequestOrBuilder.java │ │ ├── UpdateExclusionRequest.java │ │ ├── UpdateExclusionRequestOrBuilder.java │ │ ├── UpdateLogMetricRequest.java │ │ ├── UpdateLogMetricRequestOrBuilder.java │ │ ├── UpdateSettingsRequest.java │ │ ├── UpdateSettingsRequestOrBuilder.java │ │ ├── UpdateSinkRequest.java │ │ ├── UpdateSinkRequestOrBuilder.java │ │ ├── UpdateViewRequest.java │ │ ├── UpdateViewRequestOrBuilder.java │ │ ├── WriteLogEntriesPartialErrors.java │ │ ├── WriteLogEntriesPartialErrorsOrBuilder.java │ │ ├── WriteLogEntriesRequest.java │ │ ├── WriteLogEntriesRequestOrBuilder.java │ │ ├── WriteLogEntriesResponse.java │ │ └── WriteLogEntriesResponseOrBuilder.java │ └── proto │ └── google │ └── logging │ └── v2 │ ├── log_entry.proto │ ├── logging.proto │ ├── logging_config.proto │ └── logging_metrics.proto ├── renovate.json ├── samples ├── install-without-bom │ └── pom.xml ├── native-image-sample │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── logging │ │ │ └── NativeImageLoggingSample.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── logging │ │ └── ITNativeImageLoggingSample.java ├── pom.xml ├── snapshot │ └── pom.xml └── snippets │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── logging │ │ │ ├── GetSinkMetadata.java │ │ │ ├── ListLogEntries.java │ │ │ ├── ListLogs.java │ │ │ ├── LogEntryWriteHttpRequest.java │ │ │ ├── QuickstartSample.java │ │ │ ├── TailLogEntries.java │ │ │ ├── WriteLogEntry.java │ │ │ └── jul │ │ │ ├── Quickstart.java │ │ │ └── enhancers │ │ │ └── ExampleEnhancer.java │ └── resources │ │ └── logging.properties │ └── test │ └── java │ └── com │ └── example │ └── logging │ ├── LoggingIT.java │ ├── LogsIT.java │ └── SinkIT.java ├── synth.metadata └── versions.txt /.cloudbuild/samples_build.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: gcr.io/cloud-devrel-public-resources/java8 3 | entrypoint: ls 4 | args: [ 5 | '-alt', 6 | ] 7 | - name: gcr.io/cloud-devrel-public-resources/java8 8 | entrypoint: curl 9 | args: [ 10 | '--header', 11 | 'Metadata-Flavor: Google', 12 | 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email' 13 | ] 14 | - name: gcr.io/cloud-devrel-public-resources/java8 15 | entrypoint: pwd 16 | - name: gcr.io/cloud-devrel-public-resources/java8 17 | entrypoint: bash 18 | args: [ 19 | '.kokoro/build.sh' 20 | ] 21 | env: 22 | - 'JOB_TYPE=samples' 23 | - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-sample' 24 | - name: gcr.io/cloud-devrel-public-resources/java8 25 | entrypoint: echo 26 | args: [ 27 | 'Sample job succeeded', 28 | ] 29 | timeout: 3600s 30 | options: 31 | defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET 32 | 33 | -------------------------------------------------------------------------------- /.github/.OwlBot-hermetic.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | deep-remove-regex: 15 | - "/grpc-google-.*/src" 16 | - "/proto-google-.*/src" 17 | - "/google-.*/src/v.*" 18 | 19 | deep-preserve-regex: 20 | - "/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" 21 | 22 | deep-copy-regex: 23 | - source: "/google/logging/(v.*)/.*-java/proto-google-.*/src" 24 | dest: "/owl-bot-staging/$1/proto-google-cloud-logging-$1/src" 25 | - source: "/google/logging/(v.*)/.*-java/grpc-google-.*/src" 26 | dest: "/owl-bot-staging/$1/grpc-google-cloud-logging-$1/src" 27 | - source: "/google/logging/(v.*)/.*-java/gapic-google-.*/src" 28 | dest: "/owl-bot-staging/$1/google-cloud-logging/src" 29 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners file. 2 | # This file controls who is tagged for review for any given pull request. 3 | 4 | # For syntax help see: 5 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax 6 | # @googleapis/api-logging @googleapis/yoshi-java @googleapis/api-logging-partners are the default owners for changes in this repo 7 | * @googleapis/api-logging @googleapis/yoshi-java @googleapis/api-logging-partners 8 | 9 | # @googleapis/api-logging @googleapis/yoshi-java @googleapis/api-logging-partners are the default owners for samples changes 10 | samples/**/*.java @googleapis/java-samples-reviewers @googleapis/api-logging @googleapis/api-logging-partners 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | Thanks for stopping by to let us know something could be better! 8 | 9 | **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. 10 | 11 | Please run down the following list and make sure you've tried the usual "quick fixes": 12 | 13 | - Search the issues already opened: https://github.com/googleapis/java-logging/issues 14 | - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform 15 | 16 | If you are still having issues, please include as much information as possible: 17 | 18 | #### Environment details 19 | 20 | 1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). 21 | General, Core, and Other are also allowed as types 22 | 2. OS type and version: 23 | 3. Java version: 24 | 4. version(s): 25 | 26 | #### Steps to reproduce 27 | 28 | 1. ? 29 | 2. ? 30 | 31 | #### Code example 32 | 33 | ```java 34 | // example 35 | ``` 36 | 37 | #### Stack trace 38 | ``` 39 | Any relevant stacktrace here. 40 | ``` 41 | 42 | #### External references such as API reference guides 43 | 44 | - ? 45 | 46 | #### Any additional information below 47 | 48 | 49 | Following these steps guarantees the quickest resolution possible. 50 | 51 | Thanks! 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this library 4 | 5 | --- 6 | 7 | Thanks for stopping by to let us know something could be better! 8 | 9 | **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. 10 | 11 | **Is your feature request related to a problem? Please describe.** 12 | What the problem is. Example: I'm always frustrated when [...] 13 | 14 | **Describe the solution you'd like** 15 | What you want to happen. 16 | 17 | **Describe alternatives you've considered** 18 | Any alternative solutions or features you've considered. 19 | 20 | **Additional context** 21 | Any other context or screenshots about the feature request. 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support request 3 | about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. 4 | 5 | --- 6 | 7 | **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: 2 | - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-logging/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea 3 | - [ ] Ensure the tests and linter pass 4 | - [ ] Code coverage does not decrease (if any source code was changed) 5 | - [ ] Appropriate docs were updated (if necessary) 6 | 7 | Fixes # ☕️ 8 | 9 | If you write sample code, please follow the [samples format]( 10 | https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md). 11 | -------------------------------------------------------------------------------- /.github/auto-label.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | requestsize: 15 | enabled: true 16 | -------------------------------------------------------------------------------- /.github/blunderbuss.yml: -------------------------------------------------------------------------------- 1 | # Configuration for the Blunderbuss GitHub app. For more info see 2 | # https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss 3 | assign_issues: 4 | - googleapis/api-logging-java-reviewers 5 | assign_prs: 6 | - googleapis/api-logging-java-reviewers 7 | assign_prs_by: 8 | - labels: 9 | - samples 10 | to: 11 | - googleapis/java-samples-reviewers 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | # Disable version updates for Maven dependencies 8 | # we use renovate-bot as well as shared-dependencies BOM to update maven dependencies. 9 | ignore: 10 | - dependency-name: "*" 11 | - package-ecosystem: "pip" 12 | directory: "/" 13 | schedule: 14 | interval: "daily" 15 | # Disable version updates for pip dependencies 16 | # If a security vulnerability comes in, we will be notified about 17 | # it via template in the synthtool repository. 18 | ignore: 19 | - dependency-name: "*" 20 | -------------------------------------------------------------------------------- /.github/generated-files-bot.yml: -------------------------------------------------------------------------------- 1 | externalManifests: 2 | - type: json 3 | file: 'synth.metadata' 4 | jsonpath: '$.generatedFiles[*]' 5 | - type: json 6 | file: '.github/readme/synth.metadata/synth.metadata' 7 | jsonpath: '$.generatedFiles[*]' 8 | ignoreAuthors: 9 | - 'cloud-java-bot' 10 | - 'renovate-bot' 11 | - 'yoshi-automation' 12 | - 'release-please[bot]' 13 | - 'gcf-owl-bot[bot]' 14 | -------------------------------------------------------------------------------- /.github/release-please.yml: -------------------------------------------------------------------------------- 1 | bumpMinorPreMajor: true 2 | handleGHRelease: true 3 | releaseType: java-yoshi 4 | branches: 5 | - bumpMinorPreMajor: true 6 | handleGHRelease: true 7 | releaseType: java-yoshi 8 | branch: java7 9 | - bumpMinorPreMajor: true 10 | handleGHRelease: true 11 | releaseType: java-backport 12 | branch: 3.7.x 13 | - bumpMinorPreMajor: true 14 | handleGHRelease: true 15 | releaseType: java-backport 16 | extraFiles: 17 | - >- 18 | google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java 19 | branch: 3.13.x 20 | - bumpMinorPreMajor: true 21 | handleGHRelease: true 22 | releaseType: java-backport 23 | extraFiles: 24 | - >- 25 | google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java 26 | branch: 3.17.x 27 | - bumpMinorPreMajor: true 28 | handleGHRelease: true 29 | releaseType: java-backport 30 | extraFiles: 31 | - >- 32 | google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java 33 | branch: 3.21.x 34 | extraFiles: 35 | - >- 36 | google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java 37 | -------------------------------------------------------------------------------- /.github/release-trigger.yml: -------------------------------------------------------------------------------- 1 | enabled: true 2 | multiScmName: java-logging 3 | -------------------------------------------------------------------------------- /.github/snippet-bot.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/java-logging/4e5b2d1d7108d537e13ad4f2b403bb31b98d58a0/.github/snippet-bot.yml -------------------------------------------------------------------------------- /.github/trusted-contribution.yml: -------------------------------------------------------------------------------- 1 | trustedContributors: 2 | - renovate-bot 3 | - gcf-owl-bot[bot] 4 | 5 | annotations: 6 | - type: comment 7 | text: "/gcbrun" 8 | - type: label 9 | text: "kokoro:force-run" 10 | -------------------------------------------------------------------------------- /.github/workflows/approve-readme.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # Github action job to test core java library features on 15 | # downstream client libraries before they are released. 16 | on: 17 | pull_request: 18 | name: auto-merge-readme 19 | jobs: 20 | approve: 21 | runs-on: ubuntu-latest 22 | if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' 23 | steps: 24 | - uses: actions/github-script@v7 25 | with: 26 | github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} 27 | script: | 28 | // only approve PRs from yoshi-automation 29 | if (context.payload.pull_request.user.login !== "yoshi-automation") { 30 | return; 31 | } 32 | 33 | // only approve PRs like "chore: release " 34 | if (!context.payload.pull_request.title === "chore: regenerate README") { 35 | return; 36 | } 37 | 38 | // only approve PRs with README.md and synth.metadata changes 39 | const files = new Set( 40 | ( 41 | await github.paginate( 42 | github.pulls.listFiles.endpoint({ 43 | owner: context.repo.owner, 44 | repo: context.repo.repo, 45 | pull_number: context.payload.pull_request.number, 46 | }) 47 | ) 48 | ).map(file => file.filename) 49 | ); 50 | if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { 51 | return; 52 | } 53 | 54 | // approve README regeneration PR 55 | await github.pulls.createReview({ 56 | owner: context.repo.owner, 57 | repo: context.repo.repo, 58 | body: 'Rubber stamped PR!', 59 | pull_number: context.payload.pull_request.number, 60 | event: 'APPROVE' 61 | }); 62 | 63 | // attach automerge label 64 | await github.issues.addLabels({ 65 | owner: context.repo.owner, 66 | repo: context.repo.repo, 67 | issue_number: context.payload.pull_request.number, 68 | labels: ['automerge'] 69 | }); 70 | -------------------------------------------------------------------------------- /.github/workflows/hermetic_library_generation.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # GitHub action job to test core java library features on 15 | # downstream client libraries before they are released. 16 | name: Hermetic library generation upon generation config change through pull requests 17 | on: 18 | pull_request: 19 | 20 | env: 21 | REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }} 22 | GITHUB_REPOSITORY: ${{ github.repository }} 23 | jobs: 24 | library_generation: 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Determine whether the pull request comes from a fork 28 | run: | 29 | if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then 30 | echo "This PR comes from a fork. Skip library generation." 31 | echo "SHOULD_RUN=false" >> $GITHUB_ENV 32 | else 33 | echo "SHOULD_RUN=true" >> $GITHUB_ENV 34 | fi 35 | - uses: actions/checkout@v4 36 | if: env.SHOULD_RUN == 'true' 37 | with: 38 | fetch-depth: 0 39 | token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 40 | - uses: googleapis/sdk-platform-java/.github/scripts@v2.59.0 41 | if: env.SHOULD_RUN == 'true' 42 | with: 43 | base_ref: ${{ github.base_ref }} 44 | head_ref: ${{ github.head_ref }} 45 | token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 46 | -------------------------------------------------------------------------------- /.github/workflows/renovate_config_check.yaml: -------------------------------------------------------------------------------- 1 | name: Renovate Bot Config Validation 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - 'renovate.json' 7 | 8 | jobs: 9 | renovate_bot_config_validation: 10 | runs-on: ubuntu-24.04 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Set up Node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: '22' 20 | 21 | - name: Install Renovate and Config Validator 22 | run: | 23 | npm install -g npm@latest 24 | npm install --global renovate 25 | renovate-config-validator 26 | -------------------------------------------------------------------------------- /.github/workflows/samples.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # Github action job to test core java library features on 15 | # downstream client libraries before they are released. 16 | on: 17 | pull_request: 18 | name: samples 19 | jobs: 20 | checkstyle: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@v4 24 | - uses: actions/setup-java@v4 25 | with: 26 | distribution: temurin 27 | java-version: 17 28 | - name: Run checkstyle 29 | run: mvn -P lint --quiet --batch-mode checkstyle:check 30 | working-directory: samples/snippets 31 | -------------------------------------------------------------------------------- /.github/workflows/unmanaged_dependency_check.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | name: Unmanaged dependency check 4 | jobs: 5 | unmanaged_dependency_check: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - uses: actions/setup-java@v4 10 | with: 11 | distribution: temurin 12 | java-version: 11 13 | - name: Install modules 14 | shell: bash 15 | run: | 16 | # No argument to build.sh installs the modules in local Maven 17 | # repository 18 | .kokoro/build.sh 19 | - name: Unmanaged dependency check 20 | uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.49.0 21 | with: 22 | bom-path: google-cloud-logging-bom/pom.xml 23 | -------------------------------------------------------------------------------- /.github/workflows/update_generation_config.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # GitHub action job to test core java library features on 15 | # downstream client libraries before they are released. 16 | name: Update generation configuration 17 | on: 18 | schedule: 19 | - cron: '0 2 * * *' 20 | workflow_dispatch: 21 | 22 | jobs: 23 | update-generation-config: 24 | runs-on: ubuntu-24.04 25 | env: 26 | # the branch into which the pull request is merged 27 | base_branch: main 28 | steps: 29 | - uses: actions/checkout@v4 30 | with: 31 | fetch-depth: 0 32 | token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 33 | - name: Update params in generation config to latest 34 | shell: bash 35 | run: | 36 | set -x 37 | [ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com" 38 | [ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot" 39 | bash .github/scripts/update_generation_config.sh \ 40 | --base_branch "${base_branch}" \ 41 | --repo ${{ github.repository }} 42 | env: 43 | GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 44 | 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | 3 | # Packages 4 | dist 5 | bin 6 | var 7 | sdist 8 | target 9 | 10 | # Unit test / coverage reports 11 | .coverage 12 | .tox 13 | nosetests.xml 14 | 15 | # Translations 16 | *.mo 17 | 18 | # Mr Developer 19 | .mr.developer.cfg 20 | .project 21 | .pydevproject 22 | *.iml 23 | .idea 24 | .settings 25 | .DS_Store 26 | .classpath 27 | 28 | # Built documentation 29 | docs/ 30 | 31 | # Python utilities 32 | *.pyc 33 | 34 | .flattened-pom.xml 35 | 36 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "env-tests-logging"] 2 | path = env-tests-logging 3 | url = https://github.com/googleapis/env-tests-logging 4 | -------------------------------------------------------------------------------- /.kokoro/build.bat: -------------------------------------------------------------------------------- 1 | :: Copyright 2022 Google LLC 2 | :: 3 | :: Licensed under the Apache License, Version 2.0 (the "License"); 4 | :: you may not use this file except in compliance with the License. 5 | :: You may obtain a copy of the License at 6 | :: 7 | :: http://www.apache.org/licenses/LICENSE-2.0 8 | :: 9 | :: Unless required by applicable law or agreed to in writing, software 10 | :: distributed under the License is distributed on an "AS IS" BASIS, 11 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | :: See the License for the specific language governing permissions and 13 | :: limitations under the License. 14 | :: Github action job to test core java library features on 15 | :: downstream client libraries before they are released. 16 | :: See documentation in type-shell-output.bat 17 | 18 | "C:\Program Files\Git\bin\bash.exe" %~dp0build.sh 19 | -------------------------------------------------------------------------------- /.kokoro/coerce_logs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2019 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # This script finds and moves sponge logs so that they can be found by placer 17 | # and are not flagged as flaky by sponge. 18 | 19 | set -eo pipefail 20 | 21 | ## Get the directory of the build script 22 | scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) 23 | ## cd to the parent directory, i.e. the root of the git repo 24 | cd ${scriptDir}/.. 25 | 26 | job=$(basename ${KOKORO_JOB_NAME}) 27 | 28 | echo "coercing sponge logs..." 29 | for xml in `find . -name *-sponge_log.xml` 30 | do 31 | class=$(basename ${xml} | cut -d- -f2) 32 | dir=$(dirname ${xml})/${job}/${class} 33 | text=$(dirname ${xml})/${class}-sponge_log.txt 34 | mkdir -p ${dir} 35 | mv ${xml} ${dir}/sponge_log.xml 36 | mv ${text} ${dir}/sponge_log.txt 37 | done 38 | -------------------------------------------------------------------------------- /.kokoro/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} 4 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 5 | 6 | # All builds use the trampoline script to run in docker. 7 | build_file: "java-logging/.kokoro/trampoline.sh" 8 | 9 | # Tell the trampoline which build file to use. 10 | env_vars: { 11 | key: "TRAMPOLINE_BUILD_FILE" 12 | value: "github/java-logging/.kokoro/build.sh" 13 | } 14 | 15 | 16 | ############################################# 17 | # this section merged from .kokoro/common_env_vars.cfg using owlbot.py 18 | 19 | env_vars: { 20 | key: "PRODUCT_AREA_LABEL" 21 | value: "observability" 22 | } 23 | env_vars: { 24 | key: "PRODUCT_LABEL" 25 | value: "logging" 26 | } 27 | env_vars: { 28 | key: "LANGUAGE_LABEL" 29 | value: "java" 30 | } 31 | 32 | ################################################### 33 | 34 | -------------------------------------------------------------------------------- /.kokoro/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | function retry_with_backoff { 17 | attempts_left=$1 18 | sleep_seconds=$2 19 | shift 2 20 | command=$@ 21 | 22 | 23 | # store current flag state 24 | flags=$- 25 | 26 | # allow a failures to continue 27 | set +e 28 | ${command} 29 | exit_code=$? 30 | 31 | # restore "e" flag 32 | if [[ ${flags} =~ e ]] 33 | then set -e 34 | else set +e 35 | fi 36 | 37 | if [[ $exit_code == 0 ]] 38 | then 39 | return 0 40 | fi 41 | 42 | # failure 43 | if [[ ${attempts_left} > 0 ]] 44 | then 45 | echo "failure (${exit_code}), sleeping ${sleep_seconds}..." 46 | sleep ${sleep_seconds} 47 | new_attempts=$((${attempts_left} - 1)) 48 | new_sleep=$((${sleep_seconds} * 2)) 49 | retry_with_backoff ${new_attempts} ${new_sleep} ${command} 50 | fi 51 | 52 | return $exit_code 53 | } 54 | 55 | ## Helper functionss 56 | function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } 57 | function msg() { println "$*" >&2; } 58 | function println() { printf '%s\n' "$(now) $*"; } 59 | 60 | ## Helper comment to trigger updated repo dependency release -------------------------------------------------------------------------------- /.kokoro/common_env_vars.cfg: -------------------------------------------------------------------------------- 1 | 2 | ############################################# 3 | # this section merged from .kokoro/common_env_vars.cfg using owlbot.py 4 | 5 | env_vars: { 6 | key: "PRODUCT_AREA_LABEL" 7 | value: "observability" 8 | } 9 | env_vars: { 10 | key: "PRODUCT_LABEL" 11 | value: "logging" 12 | } 13 | env_vars: { 14 | key: "LANGUAGE_LABEL" 15 | value: "java" 16 | } 17 | 18 | ################################################### 19 | 20 | -------------------------------------------------------------------------------- /.kokoro/continuous/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | regex: "**/*sponge_log.txt" 8 | } 9 | } 10 | 11 | # Download trampoline resources. 12 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 13 | 14 | # Use the trampoline script to run in docker. 15 | build_file: "java-logging/.kokoro/trampoline.sh" 16 | 17 | env_vars: { 18 | key: "TRAMPOLINE_BUILD_FILE" 19 | value: "github/java-logging/.kokoro/build.sh" 20 | } 21 | 22 | env_vars: { 23 | key: "JOB_TYPE" 24 | value: "test" 25 | } 26 | 27 | 28 | ############################################# 29 | # this section merged from .kokoro/common_env_vars.cfg using owlbot.py 30 | 31 | env_vars: { 32 | key: "PRODUCT_AREA_LABEL" 33 | value: "observability" 34 | } 35 | env_vars: { 36 | key: "PRODUCT_LABEL" 37 | value: "logging" 38 | } 39 | env_vars: { 40 | key: "LANGUAGE_LABEL" 41 | value: "java" 42 | } 43 | 44 | ################################################### 45 | 46 | -------------------------------------------------------------------------------- /.kokoro/continuous/java8.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "REPORT_COVERAGE" 11 | value: "true" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/continuous/propose_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eo pipefail 18 | 19 | export NPM_CONFIG_PREFIX=/home/node/.npm-global 20 | 21 | if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then 22 | # Groom the release PR as new commits are merged. 23 | npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ 24 | --repo-url=googleapis/java-logging \ 25 | --package-name="logging" \ 26 | --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ 27 | --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ 28 | --release-type=java-yoshi 29 | fi 30 | -------------------------------------------------------------------------------- /.kokoro/dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2019 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -eo pipefail 17 | shopt -s nullglob 18 | 19 | ## Get the directory of the build script 20 | scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) 21 | ## cd to the parent directory, i.e. the root of the git repo 22 | cd ${scriptDir}/.. 23 | 24 | # include common functions 25 | source ${scriptDir}/common.sh 26 | 27 | # Print out Java 28 | java -version 29 | echo $JOB_TYPE 30 | 31 | function determineMavenOpts() { 32 | local javaVersion=$( 33 | # filter down to the version line, then pull out the version between quotes, 34 | # then trim the version number down to its minimal number (removing any 35 | # update or suffix number). 36 | java -version 2>&1 | grep "version" \ 37 | | sed -E 's/^.*"(.*?)".*$/\1/g' \ 38 | | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' 39 | ) 40 | 41 | if [[ $javaVersion == 17* ]] 42 | then 43 | # MaxPermSize is no longer supported as of jdk 17 44 | echo -n "-Xmx1024m" 45 | else 46 | echo -n "-Xmx1024m -XX:MaxPermSize=128m" 47 | fi 48 | } 49 | 50 | export MAVEN_OPTS=$(determineMavenOpts) 51 | 52 | # this should run maven enforcer 53 | retry_with_backoff 3 10 \ 54 | mvn install -B -V -ntp \ 55 | -DskipTests=true \ 56 | -Dmaven.javadoc.skip=true \ 57 | -Dclirr.skip=true 58 | 59 | mvn -B dependency:analyze -DfailOnWarning=true 60 | -------------------------------------------------------------------------------- /.kokoro/environment/appengine_flex/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | } 8 | } 9 | 10 | 11 | # Specify which tests to run 12 | env_vars: { 13 | key: "ENVIRONMENT" 14 | value: "appengine_flex" 15 | } 16 | 17 | # Download trampoline resources. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 19 | 20 | # Use the trampoline script to run in docker. 21 | build_file: "java-logging/.kokoro/trampoline.sh" 22 | 23 | # Configure the docker image for kokoro-trampoline. 24 | env_vars: { 25 | key: "TRAMPOLINE_IMAGE" 26 | value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" 27 | } 28 | 29 | env_vars: { 30 | key: "TRAMPOLINE_BUILD_FILE" 31 | value: "github/java-logging/.kokoro/environment_tests.sh" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | env_vars: { 40 | key: "GOOGLE_CLOUD_PROJECT" 41 | value: "gcloud-devel" 42 | } 43 | 44 | # add labels to help with testgrid filtering 45 | env_vars: { 46 | key: "PRODUCT_AREA_LABEL" 47 | value: "observability" 48 | } 49 | env_vars: { 50 | key: "PRODUCT_LABEL" 51 | value: "logging" 52 | } 53 | env_vars: { 54 | key: "LANGUAGE_LABEL" 55 | value: "java" 56 | } 57 | 58 | -------------------------------------------------------------------------------- /.kokoro/environment/appengine_flex/continuous.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto -------------------------------------------------------------------------------- /.kokoro/environment/appengine_flex/presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | -------------------------------------------------------------------------------- /.kokoro/environment/appengine_standard/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | } 8 | } 9 | 10 | 11 | # Specify which tests to run 12 | env_vars: { 13 | key: "ENVIRONMENT" 14 | value: "appengine_standard" 15 | } 16 | 17 | # Download trampoline resources. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 19 | 20 | # Use the trampoline script to run in docker. 21 | build_file: "java-logging/.kokoro/trampoline.sh" 22 | 23 | # Configure the docker image for kokoro-trampoline. 24 | env_vars: { 25 | key: "TRAMPOLINE_IMAGE" 26 | value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" 27 | } 28 | 29 | env_vars: { 30 | key: "TRAMPOLINE_BUILD_FILE" 31 | value: "github/java-logging/.kokoro/environment_tests.sh" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | env_vars: { 40 | key: "GOOGLE_CLOUD_PROJECT" 41 | value: "gcloud-devel" 42 | } 43 | 44 | # add labels to help with testgrid filtering 45 | env_vars: { 46 | key: "PRODUCT_AREA_LABEL" 47 | value: "observability" 48 | } 49 | env_vars: { 50 | key: "PRODUCT_LABEL" 51 | value: "logging" 52 | } 53 | env_vars: { 54 | key: "LANGUAGE_LABEL" 55 | value: "java" 56 | } 57 | 58 | -------------------------------------------------------------------------------- /.kokoro/environment/appengine_standard/continuous.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto -------------------------------------------------------------------------------- /.kokoro/environment/appengine_standard/presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | -------------------------------------------------------------------------------- /.kokoro/environment/cloudrun/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | } 8 | } 9 | 10 | 11 | # Specify which tests to run 12 | env_vars: { 13 | key: "ENVIRONMENT" 14 | value: "cloudrun" 15 | } 16 | 17 | # Download trampoline resources. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 19 | 20 | # Use the trampoline script to run in docker. 21 | build_file: "java-logging/.kokoro/trampoline.sh" 22 | 23 | # Configure the docker image for kokoro-trampoline. 24 | env_vars: { 25 | key: "TRAMPOLINE_IMAGE" 26 | value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" 27 | } 28 | 29 | env_vars: { 30 | key: "TRAMPOLINE_BUILD_FILE" 31 | value: "github/java-logging/.kokoro/environment_tests.sh" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | env_vars: { 40 | key: "GOOGLE_CLOUD_PROJECT" 41 | value: "gcloud-devel" 42 | } 43 | 44 | # add labels to help with testgrid filtering 45 | env_vars: { 46 | key: "PRODUCT_AREA_LABEL" 47 | value: "observability" 48 | } 49 | env_vars: { 50 | key: "PRODUCT_LABEL" 51 | value: "logging" 52 | } 53 | env_vars: { 54 | key: "LANGUAGE_LABEL" 55 | value: "java" 56 | } 57 | 58 | -------------------------------------------------------------------------------- /.kokoro/environment/cloudrun/continuous.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto -------------------------------------------------------------------------------- /.kokoro/environment/cloudrun/presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | -------------------------------------------------------------------------------- /.kokoro/environment/compute/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | } 8 | } 9 | 10 | 11 | # Specify which tests to run 12 | env_vars: { 13 | key: "ENVIRONMENT" 14 | value: "compute" 15 | } 16 | 17 | # Download trampoline resources. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 19 | 20 | # Use the trampoline script to run in docker. 21 | build_file: "java-logging/.kokoro/trampoline.sh" 22 | 23 | # Configure the docker image for kokoro-trampoline. 24 | env_vars: { 25 | key: "TRAMPOLINE_IMAGE" 26 | value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" 27 | } 28 | 29 | env_vars: { 30 | key: "TRAMPOLINE_BUILD_FILE" 31 | value: "github/java-logging/.kokoro/environment_tests.sh" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | env_vars: { 40 | key: "GOOGLE_CLOUD_PROJECT" 41 | value: "gcloud-devel" 42 | } 43 | 44 | # add labels to help with testgrid filtering 45 | env_vars: { 46 | key: "PRODUCT_AREA_LABEL" 47 | value: "observability" 48 | } 49 | env_vars: { 50 | key: "PRODUCT_LABEL" 51 | value: "logging" 52 | } 53 | env_vars: { 54 | key: "LANGUAGE_LABEL" 55 | value: "java" 56 | } 57 | 58 | -------------------------------------------------------------------------------- /.kokoro/environment/compute/continuous.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto -------------------------------------------------------------------------------- /.kokoro/environment/compute/presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | -------------------------------------------------------------------------------- /.kokoro/environment/functions/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | } 8 | } 9 | 10 | 11 | # Specify which tests to run 12 | env_vars: { 13 | key: "ENVIRONMENT" 14 | value: "functions" 15 | } 16 | 17 | # Download trampoline resources. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 19 | 20 | # Use the trampoline script to run in docker. 21 | build_file: "java-logging/.kokoro/trampoline.sh" 22 | 23 | # Configure the docker image for kokoro-trampoline. 24 | env_vars: { 25 | key: "TRAMPOLINE_IMAGE" 26 | value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" 27 | } 28 | 29 | env_vars: { 30 | key: "TRAMPOLINE_BUILD_FILE" 31 | value: "github/java-logging/.kokoro/environment_tests.sh" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | env_vars: { 40 | key: "GOOGLE_CLOUD_PROJECT" 41 | value: "gcloud-devel" 42 | } 43 | 44 | # add labels to help with testgrid filtering 45 | env_vars: { 46 | key: "PRODUCT_AREA_LABEL" 47 | value: "observability" 48 | } 49 | env_vars: { 50 | key: "PRODUCT_LABEL" 51 | value: "logging" 52 | } 53 | env_vars: { 54 | key: "LANGUAGE_LABEL" 55 | value: "java" 56 | } 57 | 58 | -------------------------------------------------------------------------------- /.kokoro/environment/functions/continuous.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto -------------------------------------------------------------------------------- /.kokoro/environment/functions/presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | -------------------------------------------------------------------------------- /.kokoro/environment/kubernetes/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | } 8 | } 9 | 10 | 11 | # Specify which tests to run 12 | env_vars: { 13 | key: "ENVIRONMENT" 14 | value: "kubernetes" 15 | } 16 | 17 | # Download trampoline resources. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 19 | 20 | # Use the trampoline script to run in docker. 21 | build_file: "java-logging/.kokoro/trampoline.sh" 22 | 23 | # Configure the docker image for kokoro-trampoline. 24 | env_vars: { 25 | key: "TRAMPOLINE_IMAGE" 26 | value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" 27 | } 28 | 29 | env_vars: { 30 | key: "TRAMPOLINE_BUILD_FILE" 31 | value: "github/java-logging/.kokoro/environment_tests.sh" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | env_vars: { 40 | key: "GOOGLE_CLOUD_PROJECT" 41 | value: "gcloud-devel" 42 | } 43 | 44 | # add labels to help with testgrid filtering 45 | env_vars: { 46 | key: "PRODUCT_AREA_LABEL" 47 | value: "observability" 48 | } 49 | env_vars: { 50 | key: "PRODUCT_LABEL" 51 | value: "logging" 52 | } 53 | env_vars: { 54 | key: "LANGUAGE_LABEL" 55 | value: "java" 56 | } 57 | 58 | -------------------------------------------------------------------------------- /.kokoro/environment/kubernetes/continuous.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto -------------------------------------------------------------------------------- /.kokoro/environment/kubernetes/presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | -------------------------------------------------------------------------------- /.kokoro/environment_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2021 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -eox pipefail 17 | 18 | if [[ -z "${ENVIRONMENT:-}" ]]; then 19 | echo "ENVIRONMENT not set. Exiting" 20 | exit 1 21 | fi 22 | 23 | if [[ -z "${PROJECT_ROOT:-}" ]]; then 24 | PROJECT_ROOT="${KOKORO_ARTIFACTS_DIR}/github/java-logging" 25 | fi 26 | 27 | # make sure submodule is up to date 28 | cd "$PROJECT_ROOT" 29 | git config --global --add safe.directory '*' 30 | git config --global --add safe.directory /tmpfs/src/github/java-logging 31 | git submodule update --init --recursive 32 | cd "${PROJECT_ROOT}/env-tests-logging" 33 | 34 | # Disable buffering, so that the logs stream through. 35 | export PYTHONUNBUFFERED=1 36 | 37 | # Setup service account credentials. 38 | export GOOGLE_APPLICATION_CREDENTIALS=$KOKORO_GFILE_DIR/secret_manager/java-it-service-account 39 | gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS 40 | 41 | gcloud config get-value project 42 | 43 | # Setup project id. 44 | gcloud config set project $GOOGLE_CLOUD_PROJECT 45 | 46 | # set a default zone. 47 | gcloud config set compute/zone us-central1-b 48 | 49 | # authenticate docker 50 | gcloud auth configure-docker -q 51 | 52 | # Remove old nox 53 | python3 -m pip uninstall --yes --quiet nox-automation 54 | 55 | # Install nox 56 | python3 -m pip install --upgrade --quiet nox 57 | python3 -m nox --version 58 | 59 | # Install kubectl 60 | if [[ "${ENVIRONMENT}" == "kubernetes" ]]; then 61 | curl -LO https://dl.k8s.io/release/v1.20.0/bin/linux/amd64/kubectl 62 | chmod +x kubectl 63 | mkdir -p ~/.local/bin 64 | mv ./kubectl ~/.local/bin 65 | export PATH=$PATH:~/.local/bin 66 | # install auth plugin 67 | gcloud components install gke-gcloud-auth-plugin -q 68 | export USE_GKE_GCLOUD_AUTH_PLUGIN=True 69 | fi 70 | 71 | # create a unique id for this run 72 | UUID=$(python -c 'import uuid; print(uuid.uuid1())' | head -c 7) 73 | export ENVCTL_ID=ci-$UUID 74 | echo $ENVCTL_ID 75 | 76 | # Run the specified environment test 77 | set +e 78 | python3 -m nox --session "tests(language='java', platform='$ENVIRONMENT')" 79 | TEST_STATUS_CODE=$? 80 | 81 | # destroy resources 82 | echo "cleaning up..." 83 | ${PROJECT_ROOT}/env-tests-logging/envctl/envctl java $ENVIRONMENT destroy 84 | 85 | # exit with proper status code 86 | exit $TEST_STATUS_CODE 87 | -------------------------------------------------------------------------------- /.kokoro/nightly/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | regex: "**/*sponge_log.txt" 8 | } 9 | } 10 | 11 | # Download trampoline resources. 12 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 13 | 14 | # Use the trampoline script to run in docker. 15 | build_file: "java-logging/.kokoro/trampoline.sh" 16 | 17 | env_vars: { 18 | key: "TRAMPOLINE_BUILD_FILE" 19 | value: "github/java-logging/.kokoro/build.sh" 20 | } 21 | 22 | env_vars: { 23 | key: "JOB_TYPE" 24 | value: "test" 25 | } 26 | 27 | 28 | ############################################# 29 | # this section merged from .kokoro/common_env_vars.cfg using owlbot.py 30 | 31 | env_vars: { 32 | key: "PRODUCT_AREA_LABEL" 33 | value: "observability" 34 | } 35 | env_vars: { 36 | key: "PRODUCT_LABEL" 37 | value: "logging" 38 | } 39 | env_vars: { 40 | key: "LANGUAGE_LABEL" 41 | value: "java" 42 | } 43 | 44 | ################################################### 45 | 46 | -------------------------------------------------------------------------------- /.kokoro/nightly/integration.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "integration" 12 | } 13 | # TODO: remove this after we've migrated all tests and scripts 14 | env_vars: { 15 | key: "GCLOUD_PROJECT" 16 | value: "java-docs-samples-testing" 17 | } 18 | 19 | env_vars: { 20 | key: "GOOGLE_CLOUD_PROJECT" 21 | value: "java-docs-samples-testing" 22 | } 23 | 24 | env_vars: { 25 | key: "ENABLE_FLAKYBOT" 26 | value: "true" 27 | } 28 | 29 | env_vars: { 30 | key: "GOOGLE_APPLICATION_CREDENTIALS" 31 | value: "secret_manager/java-it-service-account" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | -------------------------------------------------------------------------------- /.kokoro/nightly/java11-integration.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/java11014" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "integration" 12 | } 13 | # TODO: remove this after we've migrated all tests and scripts 14 | env_vars: { 15 | key: "GCLOUD_PROJECT" 16 | value: "gcloud-devel" 17 | } 18 | 19 | env_vars: { 20 | key: "GOOGLE_CLOUD_PROJECT" 21 | value: "gcloud-devel" 22 | } 23 | 24 | env_vars: { 25 | key: "ENABLE_FLAKYBOT" 26 | value: "true" 27 | } 28 | 29 | env_vars: { 30 | key: "GOOGLE_APPLICATION_CREDENTIALS" 31 | value: "secret_manager/java-it-service-account" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | -------------------------------------------------------------------------------- /.kokoro/nightly/java11.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java11" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/nightly/java7.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java7" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/nightly/java8-osx.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-logging/.kokoro/build.sh" 4 | -------------------------------------------------------------------------------- /.kokoro/nightly/java8-win.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-logging/.kokoro/build.bat" 4 | -------------------------------------------------------------------------------- /.kokoro/nightly/java8.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "REPORT_COVERAGE" 11 | value: "true" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/nightly/samples.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "samples" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "java-docs-samples-testing" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "java-docs-samples-testing" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-docs-samples-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-docs-samples-service-account" 33 | } 34 | 35 | env_vars: { 36 | key: "ENABLE_FLAKYBOT" 37 | value: "true" 38 | } 39 | -------------------------------------------------------------------------------- /.kokoro/populate-secrets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Google LLC. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -eo pipefail 17 | 18 | function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} 19 | function msg { println "$*" >&2 ;} 20 | function println { printf '%s\n' "$(now) $*" ;} 21 | 22 | 23 | # Populates requested secrets set in SECRET_MANAGER_KEYS from service account: 24 | # kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com 25 | SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" 26 | msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" 27 | mkdir -p ${SECRET_LOCATION} 28 | for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") 29 | do 30 | msg "Retrieving secret ${key}" 31 | docker run --entrypoint=gcloud \ 32 | --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ 33 | gcr.io/google.com/cloudsdktool/cloud-sdk \ 34 | secrets versions access latest \ 35 | --project cloud-devrel-kokoro-resources \ 36 | --secret ${key} > \ 37 | "${SECRET_LOCATION}/${key}" 38 | if [[ $? == 0 ]]; then 39 | msg "Secret written to ${SECRET_LOCATION}/${key}" 40 | else 41 | msg "Error retrieving secret ${key}" 42 | fi 43 | done 44 | -------------------------------------------------------------------------------- /.kokoro/presubmit/clirr.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | 5 | env_vars: { 6 | key: "TRAMPOLINE_IMAGE" 7 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 8 | } 9 | 10 | env_vars: { 11 | key: "JOB_TYPE" 12 | value: "clirr" 13 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | regex: "**/*sponge_log.txt" 8 | } 9 | } 10 | 11 | # Download trampoline resources. 12 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 13 | 14 | # Use the trampoline script to run in docker. 15 | build_file: "java-logging/.kokoro/trampoline.sh" 16 | 17 | env_vars: { 18 | key: "TRAMPOLINE_BUILD_FILE" 19 | value: "github/java-logging/.kokoro/build.sh" 20 | } 21 | 22 | env_vars: { 23 | key: "JOB_TYPE" 24 | value: "test" 25 | } 26 | 27 | before_action { 28 | fetch_keystore { 29 | keystore_resource { 30 | keystore_config_id: 73713 31 | keyname: "dpebot_codecov_token" 32 | } 33 | } 34 | } 35 | 36 | 37 | ############################################# 38 | # this section merged from .kokoro/common_env_vars.cfg using owlbot.py 39 | 40 | env_vars: { 41 | key: "PRODUCT_AREA_LABEL" 42 | value: "observability" 43 | } 44 | env_vars: { 45 | key: "PRODUCT_LABEL" 46 | value: "logging" 47 | } 48 | env_vars: { 49 | key: "LANGUAGE_LABEL" 50 | value: "java" 51 | } 52 | 53 | ################################################### 54 | 55 | -------------------------------------------------------------------------------- /.kokoro/presubmit/dependencies.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "TRAMPOLINE_BUILD_FILE" 11 | value: "github/java-logging/.kokoro/dependencies.sh" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native-a.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.49.0" # {x-version-update:google-cloud-shared-dependencies:current} 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | env_vars: { 36 | key: "IT_SERVICE_ACCOUNT_EMAIL" 37 | value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" 38 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native-b.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.49.0" # {x-version-update:google-cloud-shared-dependencies:current} 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | env_vars: { 36 | key: "IT_SERVICE_ACCOUNT_EMAIL" 37 | value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" 38 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native-c.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.49.0" # {x-version-update:google-cloud-shared-dependencies:current} 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | env_vars: { 36 | key: "IT_SERVICE_ACCOUNT_EMAIL" 37 | value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" 38 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/integration.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "integration" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java11.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java11" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java7.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java7" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java8-osx.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-logging/.kokoro/build.sh" 4 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java8-win.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-logging/.kokoro/build.bat" 4 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java8.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "REPORT_COVERAGE" 11 | value: "true" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/presubmit/linkage-monitor.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "TRAMPOLINE_BUILD_FILE" 11 | value: "github/java-logging/.kokoro/linkage-monitor.sh" 12 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/lint.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | 5 | env_vars: { 6 | key: "TRAMPOLINE_IMAGE" 7 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 8 | } 9 | 10 | env_vars: { 11 | key: "JOB_TYPE" 12 | value: "lint" 13 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/samples.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "samples" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "java-docs-samples-testing" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "java-docs-samples-testing" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-docs-samples-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-docs-samples-service-account" 33 | } -------------------------------------------------------------------------------- /.kokoro/readme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -eo pipefail 17 | 18 | cd ${KOKORO_ARTIFACTS_DIR}/github/java-logging 19 | 20 | # Disable buffering, so that the logs stream through. 21 | export PYTHONUNBUFFERED=1 22 | 23 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 24 | export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) 25 | 26 | # Setup git credentials 27 | echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials 28 | git config --global credential.helper 'store --file ~/.git-credentials' 29 | 30 | python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool 31 | 32 | set +e 33 | python3.6 -m autosynth.synth \ 34 | --repository=googleapis/java-logging \ 35 | --synth-file-name=.github/readme/synth.py \ 36 | --metadata-path=.github/readme/synth.metadata \ 37 | --pr-title="chore: regenerate README" \ 38 | --branch-suffix="readme" 39 | 40 | # autosynth returns 28 to signal there are no changes 41 | RETURN_CODE=$? 42 | if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] 43 | then 44 | exit ${RETURN_CODE} 45 | fi 46 | -------------------------------------------------------------------------------- /.kokoro/trampoline.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2018 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | set -eo pipefail 16 | # Always run the cleanup script, regardless of the success of bouncing into 17 | # the container. 18 | function cleanup() { 19 | chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh 20 | ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh 21 | echo "cleanup"; 22 | } 23 | trap cleanup EXIT 24 | 25 | $(dirname $0)/populate-secrets.sh # Secret Manager secrets. 26 | python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" 27 | -------------------------------------------------------------------------------- /.repo-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "api_shortname": "logging", 3 | "name_pretty": "Cloud Logging", 4 | "product_documentation": "https://cloud.google.com/logging/docs", 5 | "api_description": "allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud and Amazon Web Services. Using the BindPlane service, you can also collect this data from over 150 common application components, on-premises systems, and hybrid cloud systems. BindPlane is included with your Google Cloud project at no additional cost.", 6 | "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-logging/latest/history", 7 | "release_level": "stable", 8 | "transport": "grpc", 9 | "language": "java", 10 | "repo": "googleapis/java-logging", 11 | "repo_short": "java-logging", 12 | "distribution_name": "com.google.cloud:google-cloud-logging", 13 | "api_id": "logging.googleapis.com", 14 | "library_type": "GAPIC_COMBO", 15 | "requires_billing": true, 16 | "codeowner_team": "@googleapis/api-logging @googleapis/yoshi-java @googleapis/api-logging-partners", 17 | "issue_tracker": "https://issuetracker.google.com/savedsearches/559764", 18 | "recommended_package": "com.google.cloud.logging" 19 | } -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). 4 | 5 | The Google Security Team will respond within 5 working days of your report on g.co/vulnz. 6 | 7 | We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. 8 | -------------------------------------------------------------------------------- /_static/guide-me.svg: -------------------------------------------------------------------------------- 1 | 7 | 10 | 18 | 19 | 21 | GUIDE ME 27 | 31 | 35 | 39 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /codecov.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | codecov: 3 | ci: 4 | - source.cloud.google.com 5 | -------------------------------------------------------------------------------- /generation_config.yaml: -------------------------------------------------------------------------------- 1 | gapic_generator_version: 2.59.0 2 | googleapis_commitish: 4c2be914d36599e4db46e2d77d02f3f00665cc89 3 | libraries_bom_version: 26.61.0 4 | libraries: 5 | - api_shortname: logging 6 | name_pretty: Cloud Logging 7 | product_documentation: https://cloud.google.com/logging/docs 8 | client_documentation: https://cloud.google.com/java/docs/reference/google-cloud-logging/latest/history 9 | issue_tracker: https://issuetracker.google.com/savedsearches/559764 10 | release_level: stable 11 | language: java 12 | repo: googleapis/java-logging 13 | repo_short: java-logging 14 | distribution_name: com.google.cloud:google-cloud-logging 15 | api_id: logging.googleapis.com 16 | transport: grpc 17 | library_type: GAPIC_COMBO 18 | api_description: allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud and Amazon Web Services. Using the BindPlane service, you can also collect this data from over 150 common application components, on-premises systems, and hybrid cloud systems. BindPlane is included with your Google Cloud project at no additional cost. 19 | codeowner_team: '@googleapis/api-logging @googleapis/yoshi-java @googleapis/api-logging-partners' 20 | recommended_package: com.google.cloud.logging 21 | GAPICs: 22 | - proto_path: google/logging/v2 23 | -------------------------------------------------------------------------------- /google-cloud-logging-bom/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.google.cloud 5 | google-cloud-logging-bom 6 | 3.22.6-SNAPSHOT 7 | pom 8 | 9 | com.google.cloud 10 | sdk-platform-java-config 11 | 3.49.0 12 | 13 | 14 | Google Cloud logging BOM 15 | https://github.com/googleapis/java-logging 16 | 17 | BOM for Google Cloud Logging 18 | 19 | 20 | 21 | Google LLC 22 | 23 | 24 | 25 | 26 | chingor13 27 | Jeff Ching 28 | chingor@google.com 29 | Google LLC 30 | 31 | Developer 32 | 33 | 34 | 35 | 36 | 37 | scm:git:https://github.com/googleapis/java-logging.git 38 | scm:git:git@github.com:googleapis/java-logging.git 39 | https://github.com/googleapis/java-logging 40 | 41 | 42 | 43 | 44 | 45 | The Apache Software License, Version 2.0 46 | http://www.apache.org/licenses/LICENSE-2.0.txt 47 | repo 48 | 49 | 50 | 51 | 52 | 53 | 54 | com.google.cloud 55 | google-cloud-logging 56 | 3.22.6-SNAPSHOT 57 | 58 | 59 | com.google.api.grpc 60 | grpc-google-cloud-logging-v2 61 | 0.111.6-SNAPSHOT 62 | 63 | 64 | com.google.api.grpc 65 | proto-google-cloud-logging-v2 66 | 0.111.6-SNAPSHOT 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | org.apache.maven.plugins 75 | maven-checkstyle-plugin 76 | 77 | true 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /google-cloud-logging/clirr-ignored-differences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 3003 5 | com/google/cloud/logging/Instrumentation 6 | 7 | 8 | 7009 9 | com/google/cloud/logging/Instrumentation 10 | Instrumentation() 11 | 12 | 13 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/ITimestampDefaultFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | /** 20 | * Encapsulates implementation of default time filter. This is needed for testing since we can't 21 | * mock static classes with EasyMock 22 | */ 23 | public interface ITimestampDefaultFilter { 24 | 25 | /** 26 | * Creates a default filter with timestamp to query Cloud Logging 27 | * 28 | * @return The filter using timestamp field 29 | */ 30 | String createDefaultTimestampFilter(); 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntryIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import com.google.common.collect.Lists; 20 | import com.google.logging.v2.TailLogEntriesResponse; 21 | import java.util.ArrayDeque; 22 | import java.util.Iterator; 23 | 24 | /** 25 | * The class implements {@see Iterator} interface over {@see LogEntry} by iterating through {@see 26 | * TailLogEntriesResponse} streamed by {@code BidiStream}. This class is instantiated by {@see 27 | * LogEntryServerStream} and is not intended to be used explicitly. 28 | */ 29 | public class LogEntryIterator implements Iterator { 30 | // TODO: consider converting this to use generics instead of 31 | // fixed TailLogEntriesResponse 32 | private final Iterator streamIterator; 33 | private final ArrayDeque buffer = new ArrayDeque<>(); 34 | 35 | LogEntryIterator(Iterator streamIterator) { 36 | this.streamIterator = streamIterator; 37 | } 38 | 39 | /** {@inheritDoc} */ 40 | @Override 41 | public boolean hasNext() { 42 | return !buffer.isEmpty() || streamIterator.hasNext(); 43 | } 44 | 45 | /** {@inheritDoc} */ 46 | @Override 47 | public LogEntry next() { 48 | if (buffer.isEmpty()) { 49 | TailLogEntriesResponse response = streamIterator.next(); 50 | buffer.addAll(Lists.transform(response.getEntriesList(), LogEntry.FROM_PB_FUNCTION)); 51 | } 52 | return buffer.pop(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingEnhancer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | /** An enhancer for log entries. Used to add custom labels to the {@link LogEntry.Builder} */ 20 | public interface LoggingEnhancer { 21 | void enhanceLogEntry(LogEntry.Builder builder); 22 | } 23 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.rpc.ApiException; 21 | import com.google.cloud.grpc.BaseGrpcServiceException; 22 | import java.io.IOException; 23 | 24 | /** Logging service exception. */ 25 | public final class LoggingException extends BaseGrpcServiceException { 26 | 27 | private static final long serialVersionUID = 449689219311927047L; 28 | 29 | public LoggingException(IOException ex, boolean idempotent) { 30 | super(ex, idempotent); 31 | } 32 | 33 | @BetaApi 34 | public LoggingException(ApiException apiException) { 35 | super(apiException); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import com.google.cloud.ServiceFactory; 20 | 21 | /** An interface for Logging factories. */ 22 | public interface LoggingFactory extends ServiceFactory {} 23 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/Option.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import static com.google.common.base.Preconditions.checkNotNull; 20 | 21 | import com.google.common.base.MoreObjects; 22 | import java.io.Serializable; 23 | import java.util.Objects; 24 | 25 | /** Base class for Logging operation options. */ 26 | abstract class Option implements Serializable { 27 | 28 | private static final long serialVersionUID = -2326245820305140225L; 29 | private final OptionType optionType; 30 | private final Object value; 31 | 32 | interface OptionType { 33 | 34 | String name(); 35 | } 36 | 37 | Option(OptionType optionType, Object value) { 38 | this.optionType = checkNotNull(optionType); 39 | this.value = value; 40 | } 41 | 42 | @SuppressWarnings("unchecked") 43 | T getOptionType() { 44 | return (T) optionType; 45 | } 46 | 47 | Object getValue() { 48 | return value; 49 | } 50 | 51 | @Override 52 | public boolean equals(Object obj) { 53 | if (!(obj instanceof Option)) { 54 | return false; 55 | } 56 | Option other = (Option) obj; 57 | return Objects.equals(optionType, other.optionType) && Objects.equals(value, other.value); 58 | } 59 | 60 | @Override 61 | public int hashCode() { 62 | return Objects.hash(optionType, value); 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return MoreObjects.toStringHelper(this) 68 | .add("name", optionType.name()) 69 | .add("value", value) 70 | .toString(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/ResourceTypeEnvironmentGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import com.google.cloud.MetadataConfig; 20 | 21 | public interface ResourceTypeEnvironmentGetter { 22 | 23 | /** 24 | * Gets the value of the specified environment variable. 25 | * 26 | * @param name the name of the environment variable 27 | * @return the string value of the variable, or null if the variable is not defined 28 | * in the system environment 29 | * @see System#getenv() 30 | */ 31 | String getEnv(String name); 32 | 33 | /** 34 | * Gets the value of the specified metadata server attribute. 35 | * 36 | * @param name the name of the metadata server attribute. 37 | * @return the string value of the attribute, or null if the attribute is not defined 38 | * in the metadata or the server is not available. 39 | * @see MetadataConfig#getAttribute(String) 40 | */ 41 | String getAttribute(String name); 42 | } 43 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/ResourceTypeEnvironmentGetterImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import com.google.cloud.MetadataConfig; 20 | 21 | final class ResourceTypeEnvironmentGetterImpl implements ResourceTypeEnvironmentGetter { 22 | 23 | @Override 24 | public String getEnv(String name) { 25 | // handle exception thrown if a security manager exists and blocks access to the 26 | // process environment 27 | try { 28 | return System.getenv(name); 29 | } catch (SecurityException ex) { 30 | return null; 31 | } 32 | } 33 | 34 | @Override 35 | public String getAttribute(String name) { 36 | return MetadataConfig.getAttribute(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/Synchronicity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | /** 20 | * Used to specify the behavior of write calls to the Cloud Logging service. Specifying SYNC will 21 | * make synchronous calls; specifying ASYNC will make asynchronous calls. The default behavior is 22 | * ASYNC. 23 | */ 24 | public enum Synchronicity { 25 | SYNC, 26 | ASYNC, 27 | } 28 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/TimestampDefaultFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import static java.time.ZoneOffset.UTC; 20 | import static java.util.Locale.US; 21 | 22 | import java.time.Duration; 23 | import java.time.LocalDateTime; 24 | import java.time.format.DateTimeFormatter; 25 | 26 | public class TimestampDefaultFilter implements ITimestampDefaultFilter { 27 | @Override 28 | public String createDefaultTimestampFilter() { 29 | DateTimeFormatter rfcDateFormat = 30 | DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", US); 31 | return "timestamp>=\"" + rfcDateFormat.format(yesterday()) + "\""; 32 | } 33 | 34 | private LocalDateTime yesterday() { 35 | return LocalDateTime.now(UTC).minus(Duration.ofDays(1)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/spi/LoggingRpcFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging.spi; 18 | 19 | import com.google.cloud.logging.LoggingOptions; 20 | import com.google.cloud.spi.ServiceRpcFactory; 21 | 22 | /** 23 | * An interface for Logging RPC factory. Implementation will be loaded via {@link 24 | * java.util.ServiceLoader}. 25 | */ 26 | public interface LoggingRpcFactory extends ServiceRpcFactory {} 27 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/testing/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * A testing helper for Cloud Logging. 19 | * 20 | *

A simple usage example: 21 | * 22 | *

Before the test: 23 | * 24 | *

{@code
25 |  * RemoteLoggingHelper helper = RemoteLoggingHelper.create();
26 |  * Logging logging = helper.getOptions().getService();
27 |  * }
28 | * 29 | *

Format resource names to avoid name clashes: 30 | * 31 | *

{@code
32 |  * String metricName = RemoteLoggingHelper.formatForTest("test-metric");
33 |  * }
34 | * 35 | * @see 37 | * Google Cloud Java tools for testing 38 | */ 39 | package com.google.cloud.logging.testing; 40 | -------------------------------------------------------------------------------- /google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/MetricsServiceV2Stub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging.v2.stub; 18 | 19 | import static com.google.cloud.logging.v2.MetricsClient.ListLogMetricsPagedResponse; 20 | 21 | import com.google.api.gax.core.BackgroundResource; 22 | import com.google.api.gax.rpc.UnaryCallable; 23 | import com.google.logging.v2.CreateLogMetricRequest; 24 | import com.google.logging.v2.DeleteLogMetricRequest; 25 | import com.google.logging.v2.GetLogMetricRequest; 26 | import com.google.logging.v2.ListLogMetricsRequest; 27 | import com.google.logging.v2.ListLogMetricsResponse; 28 | import com.google.logging.v2.LogMetric; 29 | import com.google.logging.v2.UpdateLogMetricRequest; 30 | import com.google.protobuf.Empty; 31 | import javax.annotation.Generated; 32 | 33 | // AUTO-GENERATED DOCUMENTATION AND CLASS. 34 | /** 35 | * Base stub class for the MetricsServiceV2 service API. 36 | * 37 | *

This class is for advanced usage and reflects the underlying API directly. 38 | */ 39 | @Generated("by gapic-generator-java") 40 | public abstract class MetricsServiceV2Stub implements BackgroundResource { 41 | 42 | public UnaryCallable 43 | listLogMetricsPagedCallable() { 44 | throw new UnsupportedOperationException("Not implemented: listLogMetricsPagedCallable()"); 45 | } 46 | 47 | public UnaryCallable listLogMetricsCallable() { 48 | throw new UnsupportedOperationException("Not implemented: listLogMetricsCallable()"); 49 | } 50 | 51 | public UnaryCallable getLogMetricCallable() { 52 | throw new UnsupportedOperationException("Not implemented: getLogMetricCallable()"); 53 | } 54 | 55 | public UnaryCallable createLogMetricCallable() { 56 | throw new UnsupportedOperationException("Not implemented: createLogMetricCallable()"); 57 | } 58 | 59 | public UnaryCallable updateLogMetricCallable() { 60 | throw new UnsupportedOperationException("Not implemented: updateLogMetricCallable()"); 61 | } 62 | 63 | public UnaryCallable deleteLogMetricCallable() { 64 | throw new UnsupportedOperationException("Not implemented: deleteLogMetricCallable()"); 65 | } 66 | 67 | @Override 68 | public abstract void close(); 69 | } 70 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/java/com/google/cloud/logging/InvalidContextTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import static org.junit.Assert.assertThrows; 20 | 21 | import java.util.Arrays; 22 | import java.util.List; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.junit.runners.Parameterized; 26 | import org.junit.runners.Parameterized.Parameters; 27 | 28 | @RunWith(Parameterized.class) 29 | public class InvalidContextTest { 30 | @Parameters 31 | public static List data() { 32 | final String[] INVALID_W3C_TRACE_CONTEXTS = { 33 | "", 34 | "abc/efg", 35 | "01-something", 36 | "00-123456789012345678901234567890", 37 | "00-12345678901234567890123456789012", 38 | "00-12345678901234567890123456789012345", 39 | "00-12345678901234567890123456789012-123456789012345", 40 | "00-12345678901234567890123456789012-1234567890123456", 41 | "00-12345678901234567890123456789012-12345678901234567", 42 | "00-12345678901234567890123456789012-1234567890123456-1", 43 | "00-12345678901234567890123456789012-1234567890123456-123" 44 | }; 45 | return Arrays.asList(INVALID_W3C_TRACE_CONTEXTS); 46 | } 47 | 48 | private final String traceContext; 49 | 50 | public InvalidContextTest(String traceContext) { 51 | this.traceContext = traceContext; 52 | } 53 | 54 | @Test 55 | public void testAssertionInvalidContext() { 56 | Context.Builder builder = Context.newBuilder(); 57 | assertThrows( 58 | IllegalArgumentException.class, () -> builder.loadW3CTraceParentContext(traceContext)); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/java/com/google/cloud/logging/OptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | import static org.junit.Assert.assertNull; 21 | 22 | import com.google.cloud.logging.Logging.ListOption; 23 | import com.google.cloud.logging.Option.OptionType; 24 | import com.google.common.testing.EqualsTester; 25 | import org.junit.Assert; 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.JUnit4; 29 | 30 | @RunWith(JUnit4.class) 31 | public class OptionTest { 32 | 33 | private static final OptionType OPTION_TYPE = ListOption.OptionType.PAGE_SIZE; 34 | private static final OptionType ANOTHER_OPTION_TYPE = ListOption.OptionType.PAGE_TOKEN; 35 | private static final String VALUE = "some value"; 36 | private static final String OTHER_VALUE = "another value"; 37 | private static final Option OPTION = new Option(OPTION_TYPE, VALUE) {}; 38 | private static final Option OPTION_EQUALS = new Option(OPTION_TYPE, VALUE) {}; 39 | private static final Option OPTION_NOT_EQUALS1 = new Option(ANOTHER_OPTION_TYPE, OTHER_VALUE) {}; 40 | private static final Option OPTION_NOT_EQUALS2 = new Option(ANOTHER_OPTION_TYPE, VALUE) {}; 41 | 42 | @Test 43 | public void testEquals() { 44 | new EqualsTester() 45 | .addEqualityGroup(OPTION, OPTION_EQUALS) 46 | .addEqualityGroup(OPTION_NOT_EQUALS1) 47 | .addEqualityGroup(OPTION_NOT_EQUALS2) 48 | .testEquals(); 49 | } 50 | 51 | @Test 52 | public void testConstructor() { 53 | assertEquals(OPTION_TYPE, OPTION.getOptionType()); 54 | assertEquals(VALUE, OPTION.getValue()); 55 | Option option = new Option(OPTION_TYPE, null) {}; 56 | assertEquals(OPTION_TYPE, option.getOptionType()); 57 | assertNull(option.getValue()); 58 | try { 59 | new Option(null, VALUE) {}; 60 | Assert.fail(); 61 | } catch (NullPointerException expected) { 62 | 63 | } 64 | } 65 | 66 | @Test 67 | public void testListOption() { 68 | Option option = ListOption.pageSize(42); 69 | assertEquals(ListOption.OptionType.PAGE_SIZE, option.getOptionType()); 70 | assertEquals(42, option.getValue()); 71 | option = ListOption.pageToken("cursor"); 72 | assertEquals(ListOption.OptionType.PAGE_TOKEN, option.getOptionType()); 73 | assertEquals("cursor", option.getValue()); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/java/com/google/cloud/logging/TimestampDefaultFilterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging; 18 | 19 | import static com.google.common.truth.Truth.assertThat; 20 | import static java.time.ZoneOffset.UTC; 21 | import static java.util.Locale.US; 22 | 23 | import java.time.Duration; 24 | import java.time.LocalDateTime; 25 | import java.time.format.DateTimeFormatter; 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.JUnit4; 29 | 30 | @RunWith(JUnit4.class) 31 | public class TimestampDefaultFilterTest { 32 | 33 | @Test 34 | public void DefaultTimestampFilterTest() { 35 | ITimestampDefaultFilter filter = new TimestampDefaultFilter(); 36 | 37 | // Timestamp filter exists 38 | String defaultFilter = filter.createDefaultTimestampFilter(); 39 | assertThat(defaultFilter).contains("timestamp>="); 40 | 41 | // Time is last 24 hours 42 | DateTimeFormatter rfcDateFormat = 43 | DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", US); 44 | LocalDateTime actual = 45 | LocalDateTime.parse(defaultFilter.substring(12, defaultFilter.length() - 1), rfcDateFormat); 46 | assertThat( 47 | Duration.between(actual, LocalDateTime.now(UTC)) 48 | .minus(Duration.ofDays(1)) 49 | .abs() 50 | .compareTo(Duration.ofMinutes(1))) 51 | .isLessThan(0); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MockConfigServiceV2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging.v2; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockConfigServiceV2 implements MockGrpcService { 29 | private final MockConfigServiceV2Impl serviceImpl; 30 | 31 | public MockConfigServiceV2() { 32 | serviceImpl = new MockConfigServiceV2Impl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MockLoggingServiceV2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging.v2; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockLoggingServiceV2 implements MockGrpcService { 29 | private final MockLoggingServiceV2Impl serviceImpl; 30 | 31 | public MockLoggingServiceV2() { 32 | serviceImpl = new MockLoggingServiceV2Impl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MockMetricsServiceV2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging.v2; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockMetricsServiceV2 implements MockGrpcService { 29 | private final MockMetricsServiceV2Impl serviceImpl; 30 | 31 | public MockMetricsServiceV2() { 32 | serviceImpl = new MockMetricsServiceV2Impl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/java/com/google/cloud/logging/v2/testing/LocalLoggingHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.logging.v2.testing; 18 | 19 | import io.grpc.ManagedChannel; 20 | import io.grpc.Server; 21 | import io.grpc.inprocess.InProcessChannelBuilder; 22 | import io.grpc.inprocess.InProcessServerBuilder; 23 | import java.io.IOException; 24 | 25 | /** LocalLoggingHelper runs an in-memory Logging server for use in tests. */ 26 | public class LocalLoggingHelper { 27 | private final String address; 28 | private final Server server; 29 | private final LocalLoggingImpl loggingImpl; 30 | 31 | /** Constructs a new LocalLoggingHelper. The method start() must be called before it is used. */ 32 | public LocalLoggingHelper(String address) { 33 | this.address = address; 34 | this.loggingImpl = new LocalLoggingImpl(); 35 | this.server = 36 | InProcessServerBuilder.forName(address).addService(loggingImpl.bindService()).build(); 37 | } 38 | 39 | /** Starts the in-memory service. */ 40 | public void start() { 41 | try { 42 | server.start(); 43 | } catch (IOException ex) { 44 | throw new RuntimeException(ex); 45 | } 46 | } 47 | 48 | /** Resets the state of the in-memory service. */ 49 | public void reset() { 50 | loggingImpl.reset(); 51 | } 52 | 53 | /** Returns the internal in-memory service. */ 54 | public LocalLoggingImpl getLoggingImpl() { 55 | return loggingImpl; 56 | } 57 | 58 | /** Creates a channel for making requests to the in-memory service. */ 59 | public ManagedChannel createChannel() { 60 | return InProcessChannelBuilder.forName(address).usePlaintext().build(); 61 | } 62 | 63 | /** Shuts down the in-memory service. */ 64 | public void shutdownNow() { 65 | server.shutdownNow(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /google-cloud-logging/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-logging/native-image.properties: -------------------------------------------------------------------------------- 1 | Args=--initialize-at-build-time=org.junit.Ignore,\ 2 | java.lang.annotation.Annotation,\ 3 | org.junit.vintage.engine.discovery.FilterableIgnoringRunnerDecorator,\ 4 | org.junit.runners.model.FrameworkField 5 | -------------------------------------------------------------------------------- /grpc-google-cloud-logging-v2/clirr-ignored-differences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7012 5 | com/google/logging/v2/ConfigServiceV2Grpc$AsyncService 6 | void createBucketAsync(com.google.logging.v2.CreateBucketRequest, io.grpc.stub.StreamObserver) 7 | 8 | 9 | 7012 10 | com/google/logging/v2/ConfigServiceV2Grpc$AsyncService 11 | void updateBucketAsync(com.google.logging.v2.UpdateBucketRequest, io.grpc.stub.StreamObserver) 12 | 13 | 14 | 7012 15 | com/google/logging/v2/ConfigServiceV2Grpc$AsyncService 16 | void createLink(com.google.logging.v2.CreateLinkRequest, io.grpc.stub.StreamObserver) 17 | 18 | 19 | 7012 20 | com/google/logging/v2/ConfigServiceV2Grpc$AsyncService 21 | void deleteLink(com.google.logging.v2.DeleteLinkRequest, io.grpc.stub.StreamObserver) 22 | 23 | 24 | 7012 25 | com/google/logging/v2/ConfigServiceV2Grpc$AsyncService 26 | void getLink(com.google.logging.v2.GetLinkRequest, io.grpc.stub.StreamObserver) 27 | 28 | 29 | 7012 30 | com/google/logging/v2/ConfigServiceV2Grpc$AsyncService 31 | void listLinks(com.google.logging.v2.ListLinksRequest, io.grpc.stub.StreamObserver) 32 | 33 | 34 | -------------------------------------------------------------------------------- /grpc-google-cloud-logging-v2/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.google.api.grpc 6 | grpc-google-cloud-logging-v2 7 | 0.111.6-SNAPSHOT 8 | grpc-google-cloud-logging-v2 9 | GRPC library for grpc-google-cloud-logging-v2 10 | 11 | com.google.cloud 12 | google-cloud-logging-parent 13 | 3.22.6-SNAPSHOT 14 | 15 | 16 | 17 | com.google.guava 18 | guava 19 | 20 | 21 | com.google.protobuf 22 | protobuf-java 23 | 24 | 25 | io.grpc 26 | grpc-api 27 | 28 | 29 | io.grpc 30 | grpc-stub 31 | 32 | 33 | io.grpc 34 | grpc-protobuf 35 | 36 | 37 | com.google.api.grpc 38 | proto-google-common-protos 39 | 40 | 41 | com.google.api.grpc 42 | proto-google-cloud-logging-v2 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.codehaus.mojo 50 | flatten-maven-plugin 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /java.header: -------------------------------------------------------------------------------- 1 | ^/\*$ 2 | ^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$ 3 | ^ \*$ 4 | ^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ 5 | ^ \* you may not use this file except in compliance with the License\.$ 6 | ^ \* You may obtain a copy of the License at$ 7 | ^ \*$ 8 | ^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$ 9 | ^ \*$ 10 | ^ \* Unless required by applicable law or agreed to in writing, software$ 11 | ^ \* distributed under the License is distributed on an "AS IS" BASIS,$ 12 | ^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$ 13 | ^ \* See the License for the specific language governing permissions and$ 14 | ^ \* limitations under the License\.$ 15 | ^ \*/$ 16 | -------------------------------------------------------------------------------- /license-checks.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/clirr-ignored-differences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7012 6 | com/google/logging/v2/*OrBuilder 7 | * get*(*) 8 | 9 | 10 | 7012 11 | com/google/logging/v2/*OrBuilder 12 | boolean contains*(*) 13 | 14 | 15 | 7012 16 | com/google/logging/v2/*OrBuilder 17 | boolean has*(*) 18 | 19 | 20 | 21 | 22 | 7006 23 | com/google/logging/v2/** 24 | * getDefaultInstanceForType() 25 | ** 26 | 27 | 28 | 7006 29 | com/google/logging/v2/** 30 | * addRepeatedField(*) 31 | ** 32 | 33 | 34 | 7006 35 | com/google/logging/v2/** 36 | * clear() 37 | ** 38 | 39 | 40 | 7006 41 | com/google/logging/v2/** 42 | * clearField(*) 43 | ** 44 | 45 | 46 | 7006 47 | com/google/logging/v2/** 48 | * clearOneof(*) 49 | ** 50 | 51 | 52 | 7006 53 | com/google/logging/v2/** 54 | * clone() 55 | ** 56 | 57 | 58 | 7006 59 | com/google/logging/v2/** 60 | * mergeUnknownFields(*) 61 | ** 62 | 63 | 64 | 7006 65 | com/google/logging/v2/** 66 | * setField(*) 67 | ** 68 | 69 | 70 | 7006 71 | com/google/logging/v2/** 72 | * setRepeatedField(*) 73 | ** 74 | 75 | 76 | 7006 77 | com/google/logging/v2/** 78 | * setUnknownFields(*) 79 | ** 80 | 81 | 82 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.google.api.grpc 6 | proto-google-cloud-logging-v2 7 | 0.111.6-SNAPSHOT 8 | proto-google-cloud-logging-v2 9 | PROTO library for proto-google-cloud-logging-v2 10 | 11 | com.google.cloud 12 | google-cloud-logging-parent 13 | 3.22.6-SNAPSHOT 14 | 15 | 16 | 17 | com.google.guava 18 | guava 19 | 20 | 21 | com.google.protobuf 22 | protobuf-java 23 | 24 | 25 | com.google.api.grpc 26 | proto-google-common-protos 27 | 28 | 29 | com.google.api 30 | api-common 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.codehaus.mojo 38 | flatten-maven-plugin 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/BigQueryDatasetOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface BigQueryDatasetOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.BigQueryDataset) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *

31 |    * Output only. The full resource name of the BigQuery dataset. The DATASET_ID
32 |    * will match the ID of the link, so the link must match the naming
33 |    * restrictions of BigQuery datasets (alphanumeric characters and underscores
34 |    * only).
35 |    *
36 |    * The dataset will have a resource path of
37 |    *   "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]"
38 |    * 
39 | * 40 | * string dataset_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 41 | * 42 | * @return The datasetId. 43 | */ 44 | java.lang.String getDatasetId(); 45 | 46 | /** 47 | * 48 | * 49 | *
50 |    * Output only. The full resource name of the BigQuery dataset. The DATASET_ID
51 |    * will match the ID of the link, so the link must match the naming
52 |    * restrictions of BigQuery datasets (alphanumeric characters and underscores
53 |    * only).
54 |    *
55 |    * The dataset will have a resource path of
56 |    *   "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]"
57 |    * 
58 | * 59 | * string dataset_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 60 | * 61 | * @return The bytes for datasetId. 62 | */ 63 | com.google.protobuf.ByteString getDatasetIdBytes(); 64 | } 65 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/BigQueryOptionsOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface BigQueryOptionsOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.BigQueryOptions) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Optional. Whether to use [BigQuery's partition
32 |    * tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By
33 |    * default, Cloud Logging creates dated tables based on the log entries'
34 |    * timestamps, e.g. syslog_20170523. With partitioned tables the date suffix
35 |    * is no longer present and [special query
36 |    * syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables)
37 |    * has to be used instead. In both cases, tables are sharded based on UTC
38 |    * timezone.
39 |    * 
40 | * 41 | * bool use_partitioned_tables = 1 [(.google.api.field_behavior) = OPTIONAL]; 42 | * 43 | * @return The usePartitionedTables. 44 | */ 45 | boolean getUsePartitionedTables(); 46 | 47 | /** 48 | * 49 | * 50 | *
51 |    * Output only. True if new timestamp column based partitioning is in use,
52 |    * false if legacy ingestion-time partitioning is in use.
53 |    *
54 |    * All new sinks will have this field set true and will use timestamp column
55 |    * based partitioning. If use_partitioned_tables is false, this value has no
56 |    * meaning and will be false. Legacy sinks using partitioned tables will have
57 |    * this field set to false.
58 |    * 
59 | * 60 | * bool uses_timestamp_column_partitioning = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; 61 | * 62 | * 63 | * @return The usesTimestampColumnPartitioning. 64 | */ 65 | boolean getUsesTimestampColumnPartitioning(); 66 | } 67 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/CopyLogEntriesResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface CopyLogEntriesResponseOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.CopyLogEntriesResponse) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Number of log entries copied.
32 |    * 
33 | * 34 | * int64 log_entries_copied_count = 1; 35 | * 36 | * @return The logEntriesCopiedCount. 37 | */ 38 | long getLogEntriesCopiedCount(); 39 | } 40 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/DeleteBucketRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface DeleteBucketRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.DeleteBucketRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The full resource name of the bucket to delete.
32 |    *
33 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
34 |    *     "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
35 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
36 |    *     "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
37 |    *
38 |    * For example:
39 |    *
40 |    *   `"projects/my-project/locations/global/buckets/my-bucket"`
41 |    * 
42 | * 43 | * 44 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 45 | * 46 | * 47 | * @return The name. 48 | */ 49 | java.lang.String getName(); 50 | 51 | /** 52 | * 53 | * 54 | *
55 |    * Required. The full resource name of the bucket to delete.
56 |    *
57 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
58 |    *     "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
59 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
60 |    *     "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
61 |    *
62 |    * For example:
63 |    *
64 |    *   `"projects/my-project/locations/global/buckets/my-bucket"`
65 |    * 
66 | * 67 | * 68 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 69 | * 70 | * 71 | * @return The bytes for name. 72 | */ 73 | com.google.protobuf.ByteString getNameBytes(); 74 | } 75 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/DeleteExclusionRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface DeleteExclusionRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.DeleteExclusionRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of an existing exclusion to delete:
32 |    *
33 |    *     "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
34 |    *     "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
35 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
36 |    *     "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
37 |    *
38 |    * For example:
39 |    *
40 |    *   `"projects/my-project/exclusions/my-exclusion"`
41 |    * 
42 | * 43 | * 44 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 45 | * 46 | * 47 | * @return The name. 48 | */ 49 | java.lang.String getName(); 50 | 51 | /** 52 | * 53 | * 54 | *
55 |    * Required. The resource name of an existing exclusion to delete:
56 |    *
57 |    *     "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
58 |    *     "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
59 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
60 |    *     "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
61 |    *
62 |    * For example:
63 |    *
64 |    *   `"projects/my-project/exclusions/my-exclusion"`
65 |    * 
66 | * 67 | * 68 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 69 | * 70 | * 71 | * @return The bytes for name. 72 | */ 73 | com.google.protobuf.ByteString getNameBytes(); 74 | } 75 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/DeleteLinkRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface DeleteLinkRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.DeleteLinkRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The full resource name of the link to delete.
32 |    *
33 |    *  "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
34 |    *   "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
35 |    *   "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
36 |    *   "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
37 |    * 
38 | * 39 | * 40 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 41 | * 42 | * 43 | * @return The name. 44 | */ 45 | java.lang.String getName(); 46 | 47 | /** 48 | * 49 | * 50 | *
51 |    * Required. The full resource name of the link to delete.
52 |    *
53 |    *  "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
54 |    *   "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
55 |    *   "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
56 |    *   "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
57 |    * 
58 | * 59 | * 60 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 61 | * 62 | * 63 | * @return The bytes for name. 64 | */ 65 | com.google.protobuf.ByteString getNameBytes(); 66 | } 67 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/DeleteLogMetricRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_metrics.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface DeleteLogMetricRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.DeleteLogMetricRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of the metric to delete:
32 |    *
33 |    *     "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
34 |    * 
35 | * 36 | * 37 | * string metric_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 38 | * 39 | * 40 | * @return The metricName. 41 | */ 42 | java.lang.String getMetricName(); 43 | 44 | /** 45 | * 46 | * 47 | *
48 |    * Required. The resource name of the metric to delete:
49 |    *
50 |    *     "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
51 |    * 
52 | * 53 | * 54 | * string metric_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 55 | * 56 | * 57 | * @return The bytes for metricName. 58 | */ 59 | com.google.protobuf.ByteString getMetricNameBytes(); 60 | } 61 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/DeleteLogRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface DeleteLogRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.DeleteLogRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of the log to delete:
32 |    *
33 |    * * `projects/[PROJECT_ID]/logs/[LOG_ID]`
34 |    * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
35 |    * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
36 |    * * `folders/[FOLDER_ID]/logs/[LOG_ID]`
37 |    *
38 |    * `[LOG_ID]` must be URL-encoded. For example,
39 |    * `"projects/my-project-id/logs/syslog"`,
40 |    * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`.
41 |    *
42 |    * For more information about log names, see
43 |    * [LogEntry][google.logging.v2.LogEntry].
44 |    * 
45 | * 46 | * 47 | * string log_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 48 | * 49 | * 50 | * @return The logName. 51 | */ 52 | java.lang.String getLogName(); 53 | 54 | /** 55 | * 56 | * 57 | *
58 |    * Required. The resource name of the log to delete:
59 |    *
60 |    * * `projects/[PROJECT_ID]/logs/[LOG_ID]`
61 |    * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
62 |    * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
63 |    * * `folders/[FOLDER_ID]/logs/[LOG_ID]`
64 |    *
65 |    * `[LOG_ID]` must be URL-encoded. For example,
66 |    * `"projects/my-project-id/logs/syslog"`,
67 |    * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`.
68 |    *
69 |    * For more information about log names, see
70 |    * [LogEntry][google.logging.v2.LogEntry].
71 |    * 
72 | * 73 | * 74 | * string log_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 75 | * 76 | * 77 | * @return The bytes for logName. 78 | */ 79 | com.google.protobuf.ByteString getLogNameBytes(); 80 | } 81 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/DeleteSinkRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface DeleteSinkRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.DeleteSinkRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The full resource name of the sink to delete, including the
32 |    * parent resource and the sink identifier:
33 |    *
34 |    *     "projects/[PROJECT_ID]/sinks/[SINK_ID]"
35 |    *     "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
36 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
37 |    *     "folders/[FOLDER_ID]/sinks/[SINK_ID]"
38 |    *
39 |    * For example:
40 |    *
41 |    *   `"projects/my-project/sinks/my-sink"`
42 |    * 
43 | * 44 | * 45 | * string sink_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 46 | * 47 | * 48 | * @return The sinkName. 49 | */ 50 | java.lang.String getSinkName(); 51 | 52 | /** 53 | * 54 | * 55 | *
56 |    * Required. The full resource name of the sink to delete, including the
57 |    * parent resource and the sink identifier:
58 |    *
59 |    *     "projects/[PROJECT_ID]/sinks/[SINK_ID]"
60 |    *     "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
61 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
62 |    *     "folders/[FOLDER_ID]/sinks/[SINK_ID]"
63 |    *
64 |    * For example:
65 |    *
66 |    *   `"projects/my-project/sinks/my-sink"`
67 |    * 
68 | * 69 | * 70 | * string sink_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 71 | * 72 | * 73 | * @return The bytes for sinkName. 74 | */ 75 | com.google.protobuf.ByteString getSinkNameBytes(); 76 | } 77 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/DeleteViewRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface DeleteViewRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.DeleteViewRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The full resource name of the view to delete:
32 |    *
33 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
34 |    *
35 |    * For example:
36 |    *
37 |    *    `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
38 |    * 
39 | * 40 | * 41 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 42 | * 43 | * 44 | * @return The name. 45 | */ 46 | java.lang.String getName(); 47 | 48 | /** 49 | * 50 | * 51 | *
52 |    * Required. The full resource name of the view to delete:
53 |    *
54 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
55 |    *
56 |    * For example:
57 |    *
58 |    *    `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
59 |    * 
60 | * 61 | * 62 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 63 | * 64 | * 65 | * @return The bytes for name. 66 | */ 67 | com.google.protobuf.ByteString getNameBytes(); 68 | } 69 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/GetBucketRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface GetBucketRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.GetBucketRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of the bucket:
32 |    *
33 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
34 |    *     "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
35 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
36 |    *     "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
37 |    *
38 |    * For example:
39 |    *
40 |    *   `"projects/my-project/locations/global/buckets/my-bucket"`
41 |    * 
42 | * 43 | * 44 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 45 | * 46 | * 47 | * @return The name. 48 | */ 49 | java.lang.String getName(); 50 | 51 | /** 52 | * 53 | * 54 | *
55 |    * Required. The resource name of the bucket:
56 |    *
57 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
58 |    *     "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
59 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
60 |    *     "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
61 |    *
62 |    * For example:
63 |    *
64 |    *   `"projects/my-project/locations/global/buckets/my-bucket"`
65 |    * 
66 | * 67 | * 68 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 69 | * 70 | * 71 | * @return The bytes for name. 72 | */ 73 | com.google.protobuf.ByteString getNameBytes(); 74 | } 75 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/GetCmekSettingsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface GetCmekSettingsRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.GetCmekSettingsRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource for which to retrieve CMEK settings.
32 |    *
33 |    *     "projects/[PROJECT_ID]/cmekSettings"
34 |    *     "organizations/[ORGANIZATION_ID]/cmekSettings"
35 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
36 |    *     "folders/[FOLDER_ID]/cmekSettings"
37 |    *
38 |    * For example:
39 |    *
40 |    *   `"organizations/12345/cmekSettings"`
41 |    *
42 |    * Note: CMEK for the Log Router can be configured for Google Cloud projects,
43 |    * folders, organizations and billing accounts. Once configured for an
44 |    * organization, it applies to all projects and folders in the Google Cloud
45 |    * organization.
46 |    * 
47 | * 48 | * 49 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 50 | * 51 | * 52 | * @return The name. 53 | */ 54 | java.lang.String getName(); 55 | 56 | /** 57 | * 58 | * 59 | *
60 |    * Required. The resource for which to retrieve CMEK settings.
61 |    *
62 |    *     "projects/[PROJECT_ID]/cmekSettings"
63 |    *     "organizations/[ORGANIZATION_ID]/cmekSettings"
64 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
65 |    *     "folders/[FOLDER_ID]/cmekSettings"
66 |    *
67 |    * For example:
68 |    *
69 |    *   `"organizations/12345/cmekSettings"`
70 |    *
71 |    * Note: CMEK for the Log Router can be configured for Google Cloud projects,
72 |    * folders, organizations and billing accounts. Once configured for an
73 |    * organization, it applies to all projects and folders in the Google Cloud
74 |    * organization.
75 |    * 
76 | * 77 | * 78 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 79 | * 80 | * 81 | * @return The bytes for name. 82 | */ 83 | com.google.protobuf.ByteString getNameBytes(); 84 | } 85 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/GetExclusionRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface GetExclusionRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.GetExclusionRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of an existing exclusion:
32 |    *
33 |    *     "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
34 |    *     "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
35 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
36 |    *     "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
37 |    *
38 |    * For example:
39 |    *
40 |    *   `"projects/my-project/exclusions/my-exclusion"`
41 |    * 
42 | * 43 | * 44 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 45 | * 46 | * 47 | * @return The name. 48 | */ 49 | java.lang.String getName(); 50 | 51 | /** 52 | * 53 | * 54 | *
55 |    * Required. The resource name of an existing exclusion:
56 |    *
57 |    *     "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
58 |    *     "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
59 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
60 |    *     "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
61 |    *
62 |    * For example:
63 |    *
64 |    *   `"projects/my-project/exclusions/my-exclusion"`
65 |    * 
66 | * 67 | * 68 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 69 | * 70 | * 71 | * @return The bytes for name. 72 | */ 73 | com.google.protobuf.ByteString getNameBytes(); 74 | } 75 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/GetLinkRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface GetLinkRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.GetLinkRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of the link:
32 |    *
33 |    *   "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
34 |    *   "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
35 |    *   "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
36 |    *   "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]
37 |    * 
38 | * 39 | * 40 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 41 | * 42 | * 43 | * @return The name. 44 | */ 45 | java.lang.String getName(); 46 | 47 | /** 48 | * 49 | * 50 | *
51 |    * Required. The resource name of the link:
52 |    *
53 |    *   "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
54 |    *   "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
55 |    *   "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
56 |    *   "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]
57 |    * 
58 | * 59 | * 60 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 61 | * 62 | * 63 | * @return The bytes for name. 64 | */ 65 | com.google.protobuf.ByteString getNameBytes(); 66 | } 67 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/GetLogMetricRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_metrics.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface GetLogMetricRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.GetLogMetricRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of the desired metric:
32 |    *
33 |    *     "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
34 |    * 
35 | * 36 | * 37 | * string metric_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 38 | * 39 | * 40 | * @return The metricName. 41 | */ 42 | java.lang.String getMetricName(); 43 | 44 | /** 45 | * 46 | * 47 | *
48 |    * Required. The resource name of the desired metric:
49 |    *
50 |    *     "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
51 |    * 
52 | * 53 | * 54 | * string metric_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 55 | * 56 | * 57 | * @return The bytes for metricName. 58 | */ 59 | com.google.protobuf.ByteString getMetricNameBytes(); 60 | } 61 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/GetSinkRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface GetSinkRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.GetSinkRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of the sink:
32 |    *
33 |    *     "projects/[PROJECT_ID]/sinks/[SINK_ID]"
34 |    *     "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
35 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
36 |    *     "folders/[FOLDER_ID]/sinks/[SINK_ID]"
37 |    *
38 |    * For example:
39 |    *
40 |    *   `"projects/my-project/sinks/my-sink"`
41 |    * 
42 | * 43 | * 44 | * string sink_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 45 | * 46 | * 47 | * @return The sinkName. 48 | */ 49 | java.lang.String getSinkName(); 50 | 51 | /** 52 | * 53 | * 54 | *
55 |    * Required. The resource name of the sink:
56 |    *
57 |    *     "projects/[PROJECT_ID]/sinks/[SINK_ID]"
58 |    *     "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
59 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
60 |    *     "folders/[FOLDER_ID]/sinks/[SINK_ID]"
61 |    *
62 |    * For example:
63 |    *
64 |    *   `"projects/my-project/sinks/my-sink"`
65 |    * 
66 | * 67 | * 68 | * string sink_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 69 | * 70 | * 71 | * @return The bytes for sinkName. 72 | */ 73 | com.google.protobuf.ByteString getSinkNameBytes(); 74 | } 75 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/GetViewRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface GetViewRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.GetViewRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The resource name of the policy:
32 |    *
33 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
34 |    *
35 |    * For example:
36 |    *
37 |    *   `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
38 |    * 
39 | * 40 | * 41 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 42 | * 43 | * 44 | * @return The name. 45 | */ 46 | java.lang.String getName(); 47 | 48 | /** 49 | * 50 | * 51 | *
52 |    * Required. The resource name of the policy:
53 |    *
54 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
55 |    *
56 |    * For example:
57 |    *
58 |    *   `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
59 |    * 
60 | * 61 | * 62 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 63 | * 64 | * 65 | * @return The bytes for name. 66 | */ 67 | com.google.protobuf.ByteString getNameBytes(); 68 | } 69 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/ListMonitoredResourceDescriptorsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface ListMonitoredResourceDescriptorsRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.ListMonitoredResourceDescriptorsRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Optional. The maximum number of results to return from this request.
32 |    * Non-positive values are ignored.  The presence of `nextPageToken` in the
33 |    * response indicates that more results might be available.
34 |    * 
35 | * 36 | * int32 page_size = 1 [(.google.api.field_behavior) = OPTIONAL]; 37 | * 38 | * @return The pageSize. 39 | */ 40 | int getPageSize(); 41 | 42 | /** 43 | * 44 | * 45 | *
46 |    * Optional. If present, then retrieve the next batch of results from the
47 |    * preceding call to this method.  `pageToken` must be the value of
48 |    * `nextPageToken` from the previous response.  The values of other method
49 |    * parameters should be identical to those in the previous call.
50 |    * 
51 | * 52 | * string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; 53 | * 54 | * @return The pageToken. 55 | */ 56 | java.lang.String getPageToken(); 57 | 58 | /** 59 | * 60 | * 61 | *
62 |    * Optional. If present, then retrieve the next batch of results from the
63 |    * preceding call to this method.  `pageToken` must be the value of
64 |    * `nextPageToken` from the previous response.  The values of other method
65 |    * parameters should be identical to those in the previous call.
66 |    * 
67 | * 68 | * string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; 69 | * 70 | * @return The bytes for pageToken. 71 | */ 72 | com.google.protobuf.ByteString getPageTokenBytes(); 73 | } 74 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/LocationMetadataOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface LocationMetadataOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.LocationMetadata) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Indicates whether or not Log Analytics features are supported in the given
32 |    * location.
33 |    * 
34 | * 35 | * bool log_analytics_enabled = 1; 36 | * 37 | * @return The logAnalyticsEnabled. 38 | */ 39 | boolean getLogAnalyticsEnabled(); 40 | } 41 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/LogSplitOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/log_entry.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface LogSplitOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.LogSplit) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * A globally unique identifier for all log entries in a sequence of split log
32 |    * entries. All log entries with the same |LogSplit.uid| are assumed to be
33 |    * part of the same sequence of split log entries.
34 |    * 
35 | * 36 | * string uid = 1; 37 | * 38 | * @return The uid. 39 | */ 40 | java.lang.String getUid(); 41 | 42 | /** 43 | * 44 | * 45 | *
46 |    * A globally unique identifier for all log entries in a sequence of split log
47 |    * entries. All log entries with the same |LogSplit.uid| are assumed to be
48 |    * part of the same sequence of split log entries.
49 |    * 
50 | * 51 | * string uid = 1; 52 | * 53 | * @return The bytes for uid. 54 | */ 55 | com.google.protobuf.ByteString getUidBytes(); 56 | 57 | /** 58 | * 59 | * 60 | *
61 |    * The index of this LogEntry in the sequence of split log entries. Log
62 |    * entries are given |index| values 0, 1, ..., n-1 for a sequence of n log
63 |    * entries.
64 |    * 
65 | * 66 | * int32 index = 2; 67 | * 68 | * @return The index. 69 | */ 70 | int getIndex(); 71 | 72 | /** 73 | * 74 | * 75 | *
76 |    * The total number of log entries that the original LogEntry was split into.
77 |    * 
78 | * 79 | * int32 total_splits = 3; 80 | * 81 | * @return The totalSplits. 82 | */ 83 | int getTotalSplits(); 84 | } 85 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/UndeleteBucketRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging_config.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface UndeleteBucketRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.UndeleteBucketRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The full resource name of the bucket to undelete.
32 |    *
33 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
34 |    *     "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
35 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
36 |    *     "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
37 |    *
38 |    * For example:
39 |    *
40 |    *   `"projects/my-project/locations/global/buckets/my-bucket"`
41 |    * 
42 | * 43 | * 44 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 45 | * 46 | * 47 | * @return The name. 48 | */ 49 | java.lang.String getName(); 50 | 51 | /** 52 | * 53 | * 54 | *
55 |    * Required. The full resource name of the bucket to undelete.
56 |    *
57 |    *     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
58 |    *     "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
59 |    *     "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
60 |    *     "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
61 |    *
62 |    * For example:
63 |    *
64 |    *   `"projects/my-project/locations/global/buckets/my-bucket"`
65 |    * 
66 | * 67 | * 68 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 69 | * 70 | * 71 | * @return The bytes for name. 72 | */ 73 | com.google.protobuf.ByteString getNameBytes(); 74 | } 75 | -------------------------------------------------------------------------------- /proto-google-cloud-logging-v2/src/main/java/com/google/logging/v2/WriteLogEntriesResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/logging/v2/logging.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.logging.v2; 21 | 22 | public interface WriteLogEntriesResponseOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.logging.v2.WriteLogEntriesResponse) 25 | com.google.protobuf.MessageOrBuilder {} 26 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | 4 | "extends": [ 5 | ":separateMajorReleases", 6 | ":combinePatchMinorReleases", 7 | ":ignoreUnstable", 8 | ":prImmediately", 9 | ":updateNotScheduled", 10 | ":automergeDisabled", 11 | ":ignoreModulesAndTests", 12 | ":maintainLockFilesDisabled", 13 | ":autodetectPinVersions" 14 | ], 15 | "ignorePaths": [ 16 | ".kokoro/requirements.txt", 17 | ".github/workflows/approve-readme.yaml", 18 | ".github/workflows/ci.yaml", 19 | ".github/workflows/renovate_config_check.yaml", 20 | ".github/workflows/samples.yaml" 21 | ], 22 | "customManagers": [ 23 | { 24 | "customType": "regex", 25 | "fileMatch": [ 26 | "^.github/workflows/unmanaged_dependency_check.yaml$" 27 | ], 28 | "matchStrings": [ 29 | "uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v(?.+?)\\n" 30 | ], 31 | "depNameTemplate": "com.google.cloud:sdk-platform-java-config", 32 | "datasourceTemplate": "maven" 33 | } 34 | ], 35 | "packageRules": [ 36 | { 37 | "packagePatterns": [ 38 | "^com.google.guava:" 39 | ], 40 | "versionScheme": "docker" 41 | }, 42 | { 43 | "packagePatterns": [ 44 | "*" 45 | ], 46 | "semanticCommitType": "deps", 47 | "semanticCommitScope": null 48 | }, 49 | { 50 | "packagePatterns": [ 51 | "^org.apache.maven", 52 | "^org.jacoco:", 53 | "^org.codehaus.mojo:", 54 | "^org.sonatype.plugins:", 55 | "^com.google.cloud:google-cloud-shared-config" 56 | ], 57 | "semanticCommitType": "build", 58 | "semanticCommitScope": "deps" 59 | }, 60 | { 61 | "packagePatterns": [ 62 | "^com.google.cloud:google-cloud-logging", 63 | "^com.google.cloud:libraries-bom", 64 | "^com.google.cloud.samples:shared-configuration" 65 | ], 66 | "semanticCommitType": "chore", 67 | "semanticCommitScope": "deps" 68 | }, 69 | { 70 | "packagePatterns": [ 71 | "^junit:junit", 72 | "^com.google.truth:truth", 73 | "^org.mockito:mockito-core", 74 | "^org.objenesis:objenesis", 75 | "^com.google.cloud:google-cloud-conformance-tests", 76 | "^org.graalvm.buildtools:junit-platform-native" 77 | ], 78 | "semanticCommitType": "test", 79 | "semanticCommitScope": "deps" 80 | }, 81 | { 82 | "packagePatterns": [ 83 | "^com.google.cloud:google-cloud-" 84 | ], 85 | "ignoreUnstable": false 86 | }, 87 | { 88 | "packagePatterns": [ 89 | "^com.fasterxml.jackson.core" 90 | ], 91 | "groupName": "jackson dependencies" 92 | } 93 | ], 94 | "semanticCommits": true, 95 | "dependencyDashboard": true 96 | } 97 | -------------------------------------------------------------------------------- /samples/install-without-bom/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.google.cloud 5 | logging-install-without-bom 6 | jar 7 | Google Cloud Logging Install Without BOM Sample 8 | https://github.com/googleapis/java-logging 9 | 10 | 14 | 15 | com.google.cloud.samples 16 | shared-configuration 17 | 1.2.2 18 | 19 | 20 | 21 | 1.8 22 | 1.8 23 | UTF-8 24 | 25 | 26 | 27 | 28 | 29 | com.google.cloud 30 | google-cloud-logging 31 | 3.21.3 32 | 33 | 34 | 35 | 36 | junit 37 | junit 38 | 4.13.2 39 | test 40 | 41 | 42 | com.google.truth 43 | truth 44 | 1.4.4 45 | test 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | org.codehaus.mojo 54 | build-helper-maven-plugin 55 | 56 | 57 | add-snippets-source 58 | 59 | add-source 60 | 61 | 62 | 63 | ../snippets/src/main/java 64 | 65 | 66 | 67 | 68 | add-snippets-tests 69 | 70 | add-test-source 71 | 72 | 73 | 74 | ../snippets/src/test/java 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /samples/native-image-sample/README.md: -------------------------------------------------------------------------------- 1 | # Cloud Logging Client Libraries with Native Image 2 | 3 | This application uses the Google Cloud [Logging Client Libraries](https://github.com/googleapis/java-logging) and can be compiled with Native Image Native Image. 4 | 5 | ## Setup Instructions 6 | 7 | You will need to follow these prerequisite steps in order to run the samples: 8 | 9 | 1. If you have not already, [create a Google Cloud Platform Project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project). 10 | 11 | 2. Install the [Google Cloud SDK](https://cloud.google.com/sdk/) which will allow you to run the sample with your project's credentials. 12 | 13 | Once installed, log in with Application Default Credentials using the following command: 14 | 15 | ``` 16 | gcloud auth application-default login 17 | ``` 18 | 19 | **Note:** Authenticating with Application Default Credentials is convenient to use during development, but we recommend [alternate methods of authentication](https://cloud.google.com/docs/authentication/production) during production use. 20 | 21 | 3. Install the native image compiler. 22 | 23 | You can follow the [official installation instructions](https://www.graalvm.org/docs/getting-started/#install-graalvm). 24 | After following the instructions, ensure that you install the native image extension installed by running: 25 | 26 | ``` 27 | gu install native-image 28 | ``` 29 | 30 | Once you finish following the instructions, verify that the default version of Java is set to the correct version by running `java -version` in a terminal. 31 | 32 | You will see something similar to the below output: 33 | 34 | ``` 35 | $ java -version 36 | 37 | openjdk version "17.0.3" 2022-04-19 38 | OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06) 39 | OpenJDK 64-Bit Server VM GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06, mixed mode, sharing) 40 | ``` 41 | 42 | 4. Enable the [Logging APIs](https://console.cloud.google.com/flows/enableapi?apiid=logging.googleapis.com). 43 | 44 | ## Sample 45 | 46 | Navigate to this directory in a new terminal. 47 | 48 | 1. Compile the application using the native image Compiler. This step may take a few minutes. 49 | 50 | ``` 51 | mvn package -P native -DskipTests 52 | ``` 53 | 54 | 2. Run the application: 55 | 56 | ``` 57 | ./target/native-image-sample 58 | ``` 59 | 60 | 3. The application will log a message to your local terminal and to Google Cloud Console. 61 | 62 | Navigate to the [Cloud Console Logs Viewer](https://console.cloud.google.com/logs/viewer) to view you logs and find the newly generated log entry in Cloud Console: 63 | ``` 64 | This is a log produced by Native Image. 65 | ``` 66 | ### Sample Integration test with Native Image Support 67 | In order to run the sample integration test as a native image, call the following command: 68 | 69 | ``` 70 | mvn test -Pnative 71 | ``` 72 | -------------------------------------------------------------------------------- /samples/native-image-sample/src/main/java/com/example/logging/NativeImageLoggingSample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | import com.google.cloud.MonitoredResource; 20 | import com.google.cloud.logging.LogEntry; 21 | import com.google.cloud.logging.Logging; 22 | import com.google.cloud.logging.LoggingOptions; 23 | import com.google.cloud.logging.Payload.StringPayload; 24 | import com.google.cloud.logging.Severity; 25 | import java.time.Duration; 26 | import java.time.Instant; 27 | import java.util.Collections; 28 | 29 | /** Basic sample application which writes a log message to Cloud Logging. */ 30 | public class NativeImageLoggingSample { 31 | 32 | /** Runs the Logging Sample Application. */ 33 | public static void main(String[] args) throws Exception { 34 | Instant startTime = Instant.now(); 35 | // Instantiates a client 36 | Logging client = LoggingOptions.getDefaultInstance().getService(); 37 | 38 | // The name of the log to write to 39 | String logName = "nativeimage_logging_sample.log"; 40 | 41 | // The data to write to the log 42 | String text = "This is a log produced by Native Image."; 43 | 44 | LogEntry entry = 45 | LogEntry.newBuilder(StringPayload.of(text)) 46 | .setSeverity(Severity.INFO) 47 | .setLogName(logName) 48 | .setResource(MonitoredResource.newBuilder("global").build()) 49 | .build(); 50 | 51 | client.write(Collections.singleton(entry)); 52 | client.flush(); 53 | client.close(); 54 | 55 | System.out.println(String.format("Logged: %s", text)); 56 | System.out.println("Log message written to Cloud Logging."); 57 | System.out.println( 58 | "See your logs in the Cloud Console: https://console.cloud.google.com/logs/viewer " 59 | + "(Might take a few seconds to load.)"); 60 | Instant endTime = Instant.now(); 61 | Duration duration = Duration.between(startTime, endTime); 62 | System.out.println("Duration: " + duration.toString()); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /samples/native-image-sample/src/test/java/com/example/logging/ITNativeImageLoggingSample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | import static com.google.common.truth.Truth.assertThat; 20 | 21 | import com.google.cloud.testing.junit4.StdOutCaptureRule; 22 | import org.junit.Rule; 23 | import org.junit.Test; 24 | 25 | public class ITNativeImageLoggingSample { 26 | 27 | @Rule public StdOutCaptureRule stdOut = new StdOutCaptureRule(); 28 | 29 | @Test 30 | public void testLogging() throws Exception { 31 | NativeImageLoggingSample.main(new String[] {}); 32 | assertThat(stdOut.getCapturedOutputAsUtf8String()) 33 | .contains("Logged: This is a log produced by Native Image."); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /samples/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.google.cloud 5 | google-cloud-logging-samples 6 | 0.0.1-SNAPSHOT 7 | pom 8 | Google Cloud Logging Samples Parent 9 | https://github.com/googleapis/java-logging 10 | 11 | Java idiomatic client for Google Cloud Platform services. 12 | 13 | 14 | 18 | 19 | com.google.cloud.samples 20 | shared-configuration 21 | 1.2.2 22 | 23 | 24 | 25 | 1.8 26 | 1.8 27 | UTF-8 28 | 29 | 30 | 31 | snapshot 32 | install-without-bom 33 | snippets 34 | native-image-sample 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-deploy-plugin 42 | 3.1.3 43 | 44 | true 45 | 46 | 47 | 48 | org.sonatype.plugins 49 | nexus-staging-maven-plugin 50 | 1.7.0 51 | 52 | true 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | junit 61 | junit 62 | 4.13.2 63 | test 64 | 65 | 66 | com.google.truth 67 | truth 68 | 1.4.4 69 | test 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /samples/snapshot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.google.cloud 5 | logging-snapshot 6 | jar 7 | Google Cloud Logging Snapshot Samples 8 | https://github.com/googleapis/java-logging 9 | 10 | 14 | 15 | com.google.cloud.samples 16 | shared-configuration 17 | 1.2.2 18 | 19 | 20 | 21 | 1.8 22 | 1.8 23 | UTF-8 24 | 25 | 26 | 27 | 28 | 29 | com.google.cloud 30 | google-cloud-logging 31 | 3.22.6-SNAPSHOT 32 | 33 | 34 | 35 | junit 36 | junit 37 | 4.13.2 38 | test 39 | 40 | 41 | com.google.truth 42 | truth 43 | 1.4.4 44 | test 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.codehaus.mojo 53 | build-helper-maven-plugin 54 | 3.6.0 55 | 56 | 57 | add-snippets-source 58 | 59 | add-source 60 | 61 | 62 | 63 | ../snippets/src/main/java 64 | 65 | 66 | 67 | 68 | add-snippets-tests 69 | 70 | add-test-source 71 | 72 | 73 | 74 | ../snippets/src/test/java 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /samples/snippets/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.google.cloud 5 | logging-snippets 6 | jar 7 | Google Cloud Logging Snippets 8 | https://github.com/googleapis/java-logging 9 | 10 | 14 | 15 | com.google.cloud.samples 16 | shared-configuration 17 | 1.2.2 18 | 19 | 20 | 21 | 1.8 22 | 1.8 23 | UTF-8 24 | 25 | 26 | 27 | 28 | 29 | 30 | com.google.cloud 31 | libraries-bom 32 | 26.55.0 33 | pom 34 | import 35 | 36 | 37 | 38 | 39 | 40 | 41 | com.google.cloud 42 | google-cloud-logging 43 | 44 | 45 | 46 | 47 | junit 48 | junit 49 | 4.13.2 50 | test 51 | 52 | 53 | com.google.truth 54 | truth 55 | 1.4.4 56 | test 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/GetSinkMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | // [START logging_get_sink] 20 | import com.google.cloud.logging.Logging; 21 | import com.google.cloud.logging.LoggingOptions; 22 | import com.google.cloud.logging.Sink; 23 | 24 | /** Retrieve Cloud Logging Sink metadata. */ 25 | public class GetSinkMetadata { 26 | public static void main(String[] args) throws Exception { 27 | // TODO(developer): Replace these variables before running the sample. 28 | // The Name of your sink 29 | String sinkName = "sink-name"; // i.e my-sink 30 | 31 | getSinkMetadata(sinkName); 32 | } 33 | 34 | public static void getSinkMetadata(String sinkName) throws Exception { 35 | // Instantiates a logging client 36 | try (Logging logging = LoggingOptions.getDefaultInstance().getService()) { 37 | 38 | Sink sink = logging.getSink(sinkName); 39 | 40 | // print sink metadata 41 | System.out.println("Name:" + sink.getName()); 42 | System.out.println("Version Format:" + sink.getVersionFormat()); 43 | System.out.println("Filter:" + sink.getFilter()); 44 | System.out.println("Destination:" + sink.getDestination()); 45 | } 46 | } 47 | } 48 | // [END logging_get_sink] 49 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/ListLogEntries.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | // [START logging_list_log_entries] 20 | import com.google.api.gax.paging.Page; 21 | import com.google.cloud.logging.LogEntry; 22 | import com.google.cloud.logging.Logging; 23 | import com.google.cloud.logging.Logging.EntryListOption; 24 | import com.google.cloud.logging.LoggingOptions; 25 | import java.text.DateFormat; 26 | import java.text.SimpleDateFormat; 27 | import java.util.Calendar; 28 | import java.util.TimeZone; 29 | 30 | public class ListLogEntries { 31 | 32 | public static void main(String[] args) throws Exception { 33 | // TODO(developer): Replace the variable value with valid log name before running the sample 34 | // or provide it as an argument. 35 | String logName = args.length > 0 ? args[0] : "test-log"; 36 | 37 | try (Logging logging = LoggingOptions.getDefaultInstance().getService()) { 38 | 39 | // When composing a filter, using indexed fields, such as timestamp, resource.type, logName 40 | // and 41 | // others can help accelerate the results 42 | // Full list of indexed fields here: 43 | // https://cloud.google.com/logging/docs/view/advanced-queries#finding-quickly 44 | // This sample restrict the results to only last minute to minimize number of API calls 45 | Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); 46 | calendar.add(Calendar.MINUTE, -1); 47 | DateFormat rfc3339 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); 48 | String logFilter = 49 | "logName=projects/" 50 | + logging.getOptions().getProjectId() 51 | + "/logs/" 52 | + logName 53 | + " AND timestamp>=\"" 54 | + rfc3339.format(calendar.getTime()) 55 | + "\""; 56 | 57 | // List all log entries 58 | Page entries = logging.listLogEntries(EntryListOption.filter(logFilter)); 59 | while (entries != null) { 60 | for (LogEntry logEntry : entries.iterateAll()) { 61 | System.out.println(logEntry); 62 | } 63 | entries = entries.getNextPage(); 64 | } 65 | } 66 | } 67 | } 68 | // [END logging_list_log_entries] 69 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/ListLogs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | // [START logging_list_logs] 20 | import com.google.api.gax.paging.Page; 21 | import com.google.cloud.logging.Logging; 22 | import com.google.cloud.logging.LoggingOptions; 23 | 24 | public class ListLogs { 25 | 26 | public static void main(String... args) throws Exception { 27 | 28 | try (Logging logging = LoggingOptions.getDefaultInstance().getService()) { 29 | 30 | // List all log names 31 | Page logNames = logging.listLogs(); 32 | while (logNames != null) { 33 | for (String logName : logNames.iterateAll()) { 34 | System.out.println(logName); 35 | } 36 | logNames = logNames.getNextPage(); 37 | } 38 | } 39 | } 40 | } 41 | // [END logging_list_logs] 42 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/LogEntryWriteHttpRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | // [START logging_write_log_entry_advanced] 20 | import com.google.cloud.MonitoredResource; 21 | import com.google.cloud.logging.HttpRequest; 22 | import com.google.cloud.logging.LogEntry; 23 | import com.google.cloud.logging.Logging; 24 | import com.google.cloud.logging.LoggingOptions; 25 | import com.google.cloud.logging.Payload; 26 | import com.google.cloud.logging.Severity; 27 | import java.util.Collections; 28 | 29 | /** Write LogEntry with HTTP request using the Cloud Logging API. */ 30 | public class LogEntryWriteHttpRequest { 31 | 32 | public static void main(String[] args) throws Exception { 33 | // TODO(developer): Replace these variables before running the sample. 34 | String logName = "log-name"; // i.e "my-log" 35 | String payLoad = "payload"; // i.e "Hello world!" 36 | HttpRequest httpRequest = 37 | HttpRequest.newBuilder() 38 | .setRequestUrl("www.example.com") 39 | .setRequestMethod(HttpRequest.RequestMethod.GET) // Supported method GET,POST,PUT,HEAD 40 | .setStatus(200) 41 | .build(); 42 | createLogEntryRequest(logName, payLoad, httpRequest); 43 | } 44 | 45 | public static void createLogEntryRequest(String logName, String payLoad, HttpRequest httpRequest) 46 | throws Exception { 47 | // Instantiates a logging client 48 | try (Logging logging = LoggingOptions.getDefaultInstance().getService()) { 49 | // create an instance of LogEntry with HTTP request 50 | LogEntry logEntry = 51 | LogEntry.newBuilder(Payload.StringPayload.of(payLoad)) 52 | .setSeverity(Severity.ERROR) 53 | .setLogName(logName) 54 | .setHttpRequest(httpRequest) 55 | .setResource(MonitoredResource.newBuilder("global").build()) 56 | .build(); 57 | 58 | // Writes the log entry asynchronously 59 | logging.write(Collections.singleton(logEntry)); 60 | System.out.printf("Logged: %s", payLoad); 61 | } 62 | } 63 | } 64 | // [END logging_write_log_entry_advanced] 65 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/QuickstartSample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | // [START logging_quickstart] 20 | import com.google.cloud.MonitoredResource; 21 | import com.google.cloud.logging.LogEntry; 22 | import com.google.cloud.logging.Logging; 23 | import com.google.cloud.logging.LoggingOptions; 24 | import com.google.cloud.logging.Payload.StringPayload; 25 | import com.google.cloud.logging.Severity; 26 | import java.util.Collections; 27 | 28 | /** 29 | * This sample demonstrates writing logs using the Cloud Logging API. The library also offers a 30 | * java.util.logging Handler `com.google.cloud.logging.LoggingHandler` Logback integration is also 31 | * available : 32 | * https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-contrib/google-cloud-logging-logback 33 | * Using the java.util.logging handler / Logback appender should be preferred to using the API 34 | * directly. 35 | */ 36 | public class QuickstartSample { 37 | 38 | /** Expects a new or existing Cloud log name as the first argument. */ 39 | public static void main(String... args) throws Exception { 40 | // The name of the log to write to 41 | String logName = args[0]; // "my-log"; 42 | String textPayload = "Hello, world!"; 43 | 44 | // Instantiates a client 45 | try (Logging logging = LoggingOptions.getDefaultInstance().getService()) { 46 | 47 | LogEntry entry = 48 | LogEntry.newBuilder(StringPayload.of(textPayload)) 49 | .setSeverity(Severity.ERROR) 50 | .setLogName(logName) 51 | .setResource(MonitoredResource.newBuilder("global").build()) 52 | .build(); 53 | 54 | // Writes the log entry asynchronously 55 | logging.write(Collections.singleton(entry)); 56 | 57 | // Optional - flush any pending log entries just before Logging is closed 58 | logging.flush(); 59 | } 60 | System.out.printf("Logged: %s%n", textPayload); 61 | } 62 | } 63 | // [END logging_quickstart] 64 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/TailLogEntries.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | // [START logging_tail_log_entries] 20 | import com.google.cloud.logging.LogEntry; 21 | import com.google.cloud.logging.LogEntryServerStream; 22 | import com.google.cloud.logging.Logging; 23 | import com.google.cloud.logging.Logging.TailOption; 24 | import com.google.cloud.logging.LoggingOptions; 25 | 26 | public class TailLogEntries { 27 | 28 | public static void main(String[] args) throws Exception { 29 | // TODO(developer): Optionally provide the logname as an argument. 30 | String logName = args.length > 0 ? args[0] : ""; 31 | 32 | LoggingOptions options = LoggingOptions.getDefaultInstance(); 33 | try (Logging logging = options.getService()) { 34 | 35 | // Optionally compose a filter to tail log entries only from specific log 36 | LogEntryServerStream stream; 37 | 38 | if (logName != "") { 39 | stream = 40 | logging.tailLogEntries( 41 | TailOption.filter( 42 | "logName=projects/" + options.getProjectId() + "/logs/" + logName)); 43 | } else { 44 | stream = logging.tailLogEntries(); 45 | } 46 | System.out.println("start streaming.."); 47 | for (LogEntry log : stream) { 48 | System.out.println(log); 49 | // cancel infinite streaming after receiving first entry 50 | stream.cancel(); 51 | } 52 | } 53 | } 54 | } 55 | // [END logging_tail_log_entries] 56 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/WriteLogEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | // [START logging_write_log_entry] 20 | import com.google.cloud.MonitoredResource; 21 | import com.google.cloud.logging.LogEntry; 22 | import com.google.cloud.logging.Logging; 23 | import com.google.cloud.logging.LoggingOptions; 24 | import com.google.cloud.logging.Payload.JsonPayload; 25 | import com.google.cloud.logging.Severity; 26 | import com.google.common.collect.ImmutableMap; 27 | import java.util.Collections; 28 | import java.util.Map; 29 | 30 | public class WriteLogEntry { 31 | 32 | public static void main(String[] args) throws Exception { 33 | // TODO(developer): Optionally provide the logname as an argument 34 | String logName = args.length > 0 ? args[0] : "test-log"; 35 | 36 | // Instantiates a client 37 | try (Logging logging = LoggingOptions.getDefaultInstance().getService()) { 38 | Map payload = 39 | ImmutableMap.of( 40 | "name", "King Arthur", "quest", "Find the Holy Grail", "favorite_color", "Blue"); 41 | LogEntry entry = 42 | LogEntry.newBuilder(JsonPayload.of(payload)) 43 | .setSeverity(Severity.INFO) 44 | .setLogName(logName) 45 | .setResource(MonitoredResource.newBuilder("global").build()) 46 | .build(); 47 | 48 | // Writes the log entry asynchronously 49 | logging.write(Collections.singleton(entry)); 50 | 51 | // Optional - flush any pending log entries just before Logging is closed 52 | logging.flush(); 53 | } 54 | System.out.printf("Wrote to %s\n", logName); 55 | } 56 | } 57 | // [END logging_write_log_entry] 58 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/jul/Quickstart.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging.jul; 18 | 19 | // [START logging_jul_quickstart] 20 | 21 | import java.util.logging.Logger; 22 | 23 | public class Quickstart { 24 | private static final Logger logger = Logger.getLogger(Quickstart.class.getName()); 25 | 26 | public static void main(String[] args) { 27 | logger.info("Logging INFO with java.util.logging"); 28 | logger.severe("Logging ERROR with java.util.logging"); 29 | } 30 | } 31 | // [END logging_jul_quickstart] 32 | -------------------------------------------------------------------------------- /samples/snippets/src/main/java/com/example/logging/jul/enhancers/ExampleEnhancer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging.jul.enhancers; 18 | 19 | import com.google.cloud.logging.LogEntry; 20 | import com.google.cloud.logging.LoggingEnhancer; 21 | 22 | // Add / update additional fields to the log entry 23 | public class ExampleEnhancer implements LoggingEnhancer { 24 | 25 | @Override 26 | public void enhanceLogEntry(LogEntry.Builder logEntry) { 27 | // add additional labels 28 | logEntry.addLabel("test-label-1", "test-value-1"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /samples/snippets/src/main/resources/logging.properties: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Google Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # A default java.util.logging configuration. 17 | # 18 | # [START logging_jul_config] 19 | # To use this configuration, add to system properties : -Djava.util.logging.config.file="/path/to/file" 20 | # 21 | .level = INFO 22 | 23 | # it is recommended that io.grpc and sun.net logging level is kept at INFO level, 24 | # as both these packages are used by Cloud internals and can result in verbose / initialization problems. 25 | io.grpc.netty.level=INFO 26 | sun.net.level=INFO 27 | 28 | com.example.logging.jul.Quickstart.handlers=com.google.cloud.logging.LoggingHandler 29 | # default : java.log 30 | com.google.cloud.logging.LoggingHandler.log=custom_log 31 | 32 | # default : INFO 33 | com.google.cloud.logging.LoggingHandler.level=FINE 34 | 35 | # default : ERROR 36 | com.google.cloud.logging.LoggingHandler.flushLevel=ERROR 37 | 38 | # default : auto-detected, fallback "global" 39 | com.google.cloud.logging.LoggingHandler.resourceType=container 40 | 41 | # custom formatter 42 | com.google.cloud.logging.LoggingHandler.formatter=java.util.logging.SimpleFormatter 43 | java.util.logging.SimpleFormatter.format=%3$s: %5$s%6$s 44 | 45 | #optional enhancers (to add additional fields, labels) 46 | com.google.cloud.logging.LoggingHandler.enhancers=com.example.logging.jul.enhancers.ExampleEnhancer 47 | # [END logging_jul_config] 48 | -------------------------------------------------------------------------------- /samples/snippets/src/test/java/com/example/logging/LogsIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | import static com.google.common.truth.Truth.assertThat; 20 | 21 | import java.io.ByteArrayOutputStream; 22 | import java.io.PrintStream; 23 | import org.junit.After; 24 | import org.junit.Before; 25 | import org.junit.Test; 26 | 27 | public class LogsIT { 28 | private static final String GOOGLEAPIS_AUDIT_LOGNAME = "cloudaudit.googleapis.com%2Factivity"; 29 | 30 | private ByteArrayOutputStream bout; 31 | private PrintStream out; 32 | 33 | @Before 34 | public void setUp() { 35 | bout = new ByteArrayOutputStream(); 36 | out = new PrintStream(bout); 37 | System.setOut(out); 38 | } 39 | 40 | @After 41 | public void tearDown() { 42 | System.setOut(null); 43 | } 44 | 45 | @Test(timeout = 60000) 46 | public void testListLogNamesSample() throws Exception { 47 | ListLogs.main(); 48 | // Check for mocked STDOUT having data 49 | while (bout.toString().isEmpty()) { 50 | Thread.sleep(1000); 51 | } 52 | assertThat(bout.toString().contains(GOOGLEAPIS_AUDIT_LOGNAME)).isTrue(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /samples/snippets/src/test/java/com/example/logging/SinkIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.logging; 18 | 19 | import static org.junit.Assert.assertNotNull; 20 | import static org.junit.Assert.assertTrue; 21 | 22 | import com.google.cloud.logging.Logging; 23 | import com.google.cloud.logging.LoggingOptions; 24 | import com.google.cloud.logging.Sink; 25 | import com.google.cloud.logging.SinkInfo; 26 | import java.io.ByteArrayOutputStream; 27 | import java.io.PrintStream; 28 | import java.util.UUID; 29 | import org.junit.After; 30 | import org.junit.Before; 31 | import org.junit.Test; 32 | import org.junit.runner.RunWith; 33 | import org.junit.runners.JUnit4; 34 | 35 | /** Tests for sink sample. */ 36 | @RunWith(JUnit4.class) 37 | public class SinkIT { 38 | 39 | private Logging logging = LoggingOptions.getDefaultInstance().getService(); 40 | private static final String SINK_NAME = "test-sink" + UUID.randomUUID().toString(); 41 | 42 | @Before 43 | public void setUp() { 44 | // Create sink 45 | logging.create( 46 | SinkInfo.newBuilder(SINK_NAME, SinkInfo.Destination.DatasetDestination.of("dataset")) 47 | .setFilter("severity>=ERROR") 48 | .setVersionFormat(SinkInfo.VersionFormat.V2) 49 | .build()); 50 | } 51 | 52 | @After 53 | public void tearDown() throws Exception { 54 | // Delete sink 55 | logging.deleteSink(SINK_NAME); 56 | logging.close(); 57 | } 58 | 59 | @Test 60 | public void testGetSinkMetadata() throws Exception { 61 | Sink sink = logging.getSink(SINK_NAME); 62 | assertNotNull(sink); 63 | PrintStream standardOut = System.out; 64 | ByteArrayOutputStream snippetOutputCapture = new ByteArrayOutputStream(); 65 | System.setOut(new PrintStream(snippetOutputCapture)); 66 | GetSinkMetadata.getSinkMetadata(SINK_NAME); 67 | String snippetOutput = snippetOutputCapture.toString(); 68 | System.setOut(standardOut); 69 | assertTrue(snippetOutput.contains(("Name:" + sink.getName()))); 70 | assertTrue(snippetOutput.contains(("Version Format:" + sink.getVersionFormat()))); 71 | assertTrue(snippetOutput.contains(("Filter:" + sink.getFilter()))); 72 | assertTrue(snippetOutput.contains(("Destination:" + sink.getDestination()))); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /versions.txt: -------------------------------------------------------------------------------- 1 | # Format: 2 | # module:released-version:current-version 3 | 4 | google-cloud-logging:3.22.5:3.22.6-SNAPSHOT 5 | grpc-google-cloud-logging-v2:0.111.5:0.111.6-SNAPSHOT 6 | proto-google-cloud-logging-v2:0.111.5:0.111.6-SNAPSHOT 7 | --------------------------------------------------------------------------------