From a5650c72ce10f674a2329d3bc9cbcfe238c41c8e Mon Sep 17 00:00:00 2001 From: mukunda katta Date: Thu, 30 Apr 2026 15:27:04 -0700 Subject: [PATCH 1/2] docs(logging): update quickstart guidance --- .../com/example/logging/QuickstartSample.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java b/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java index f44e1c3289ad..9d86d635cbe3 100644 --- a/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java +++ b/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java @@ -26,19 +26,22 @@ import java.util.Collections; /** - * This sample demonstrates writing logs using the Cloud Logging API. The library also offers a - * java.util.logging Handler `com.google.cloud.logging.LoggingHandler` Logback integration is also - * available : - * https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-contrib/google-cloud-logging-logback - * Using the java.util.logging handler / Logback appender should be preferred to using the API - * directly. + * This sample demonstrates writing logs directly with the Cloud Logging API. + * + *

Authenticate by running `gcloud auth application-default login`, by setting the + * GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account key path, or by running + * this sample on Google Cloud where Application Default Credentials are available automatically. + * + *

For production applications, prefer using a standard logging framework with Cloud Logging + * integration, such as Logback with https://github.com/googleapis/java-logging-logback. If you need + * more customizable LogEntry fields, see the WriteLogEntry sample. */ public class QuickstartSample { /** Expects a new or existing Cloud log name as the first argument. */ public static void main(String... args) throws Exception { // The name of the log to write to - String logName = args[0]; // "my-log"; + String logName = args.length > 0 ? args[0] : "my-log"; String textPayload = "Hello, world!"; // Instantiates a client From 29b6da8472a341b1b4bafd4d6ef6779bbe8ff1b6 Mon Sep 17 00:00:00 2001 From: Mukunda Katta Date: Thu, 7 May 2026 10:05:20 -0700 Subject: [PATCH 2/2] docs(logging): use Javadoc tags instead of Markdown in QuickstartSample Address Gemini code-assist feedback: switch backticks to {@code ...} for inline code references, and wrap the java-logging-logback URL in tags so it renders as a clickable link in generated Javadoc. Per Google Java Style Guide section 7.1.1, Javadoc must be HTML-formatted (Markdown is not supported across all viewers). --- .../java/com/example/logging/QuickstartSample.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java b/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java index 9d86d635cbe3..ad8f15c1fa45 100644 --- a/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java +++ b/java-logging/samples/snippets/src/main/java/com/example/logging/QuickstartSample.java @@ -28,13 +28,15 @@ /** * This sample demonstrates writing logs directly with the Cloud Logging API. * - *

Authenticate by running `gcloud auth application-default login`, by setting the - * GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account key path, or by running - * this sample on Google Cloud where Application Default Credentials are available automatically. + *

Authenticate by running {@code gcloud auth application-default login}, by setting the + * {@code GOOGLE_APPLICATION_CREDENTIALS} environment variable to a service account key path, or by + * running this sample on Google Cloud where Application Default Credentials are available + * automatically. * *

For production applications, prefer using a standard logging framework with Cloud Logging - * integration, such as Logback with https://github.com/googleapis/java-logging-logback. If you need - * more customizable LogEntry fields, see the WriteLogEntry sample. + * integration, such as Logback with https://github.com/googleapis/java-logging-logback. + * If you need more customizable {@code LogEntry} fields, see the {@code WriteLogEntry} sample. */ public class QuickstartSample {