Skip to content

docs(logging): update quickstart guidance#12975

Open
MukundaKatta wants to merge 1 commit intogoogleapis:mainfrom
MukundaKatta:codex/java-logging-quickstart
Open

docs(logging): update quickstart guidance#12975
MukundaKatta wants to merge 1 commit intogoogleapis:mainfrom
MukundaKatta:codex/java-logging-quickstart

Conversation

@MukundaKatta
Copy link
Copy Markdown

Fixes #11924.

Updates the Java Cloud Logging quickstart to:

  • include authentication guidance in the sample comments
  • recommend standard logging framework integration, specifically Logback, for production use
  • point users who need custom LogEntry fields to the WriteLogEntry sample
  • provide a default log name so the sample can run without command-line arguments

Verification:

  • git diff --check

Not run locally:

  • mvn test (mvn is not installed in this environment)

@MukundaKatta MukundaKatta requested a review from a team as a code owner April 30, 2026 22:27
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the QuickstartSample Javadoc to include authentication instructions and production logging recommendations, and modifies the main method to safely handle the log name argument. The review feedback suggests adhering to standard Javadoc formatting by using HTML tags and {@code ...} blocks instead of Markdown backticks for better compatibility with documentation tools.

Comment on lines +31 to +37
* <p>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.
*
* <p>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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Standard Javadoc should use HTML tags and Javadoc-specific tags (like {@code ...}) rather than Markdown-style backticks for code references. Additionally, URLs should be wrapped in tags to be clickable in the generated documentation, and class names should be wrapped in {@code ...} for better clarity. This ensures the documentation renders correctly across all Javadoc viewers.

Suggested change
* <p>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.
*
* <p>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.
* <p>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.
*
* <p>For production applications, prefer using a standard logging framework with Cloud Logging
* integration, such as Logback with <a href="https://github.com/googleapis/java-logging-logback">https://github.com/googleapis/java-logging-logback</a>. If you need
* more customizable {@code LogEntry} fields, see the {@code WriteLogEntry} sample.
References
  1. According to the Google Java Style Guide (Section 7.1.1), Javadoc blocks should be HTML-formatted. Standard Javadoc does not support Markdown-style backticks; instead, use {@code ...} for code snippets and HTML tags for links. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java-logging] Sample: update quickstart snippet

1 participant