Skip to content

docs(logging): fix pagination, UTC formatting, null check, and stale links in samples - #82

Open
lqiu96 wants to merge 1 commit into
mainfrom
docs/log-0j-fix-logging-samples
Open

lqiu96 wants to merge 1 commit into
mainfrom
docs/log-0j-fix-logging-samples

Conversation

@lqiu96

@lqiu96 lqiu96 commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Fixes runtime bugs, stale links, and deprecated configuration in java-logging/samples/:

  • ListLogEntries.java and ListLogs.java: replaces the O(N^2) while (page != null) + iterateAll() + getNextPage() loop with single-pass iterateAll().
  • ListLogEntries.java: sets UTC timezone on SimpleDateFormat so the literal 'Z' suffix matches UTC time, and updates the legacy advanced-queries URL.
  • TailLogEntries.java: replaces reference inequality logName != "" with !logName.isEmpty().
  • GetSinkMetadata.java: adds a sink == null guard before calling sink.getName().
  • QuickstartSample.java: replaces the dead 404 google-cloud-contrib/google-cloud-logging-logback URL with https://github.com/googleapis/google-cloud-java/tree/main/java-logging-logback and fixes raw backticks in Javadoc.
  • Updates client creation in edited samples to document singleton reuse with shutdown close() in finally.
  • logging.properties: replaces deprecated resourceType=container with k8s_container.
  • samples/native-image-sample/README.md: updates the archived googleapis/java-logging URL to the monorepo path and fixes typos ("Native Image Native Image", "view you logs").

Verified with google-java-format and JDK 25 mvn -f java-logging/samples/snippets/pom.xml test-compile.

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.

1 participant