Skip to content

Add GIGL_DISABLE_CLOUD_LOGGING to opt out of GCP JSON log lines - #727

Draft
kmontemayor2-sc wants to merge 8 commits into
mainfrom
kmonte/plain_console_logging_knob
Draft

Add GIGL_DISABLE_CLOUD_LOGGING to opt out of GCP JSON log lines#727
kmontemayor2-sc wants to merge 8 commits into
mainfrom
kmonte/plain_console_logging_knob

Conversation

@kmontemayor2-sc

Copy link
Copy Markdown
Collaborator

Add opt out of cloud logging. We've found that not all envs work nicely with structured logging

jchmura-sc and others added 8 commits July 29, 2026 20:48
On App Engine and Kubernetes, Logger routes records through
google.cloud.logging, which on GKE installs StructuredLogHandler -- a handler
that renders every record as a single-line GCP JSON envelope and hardcodes that
format, so setFormatter cannot change it.

Under Ray that envelope is a pure loss. Ray relays worker output to the driver
behind a "(RayTrainWorker pid=...)" prefix, which makes the line invalid JSON, so
Cloud Logging stores it as a plain textPayload and drops severity,
sourceLocation, and trace correlation anyway. The reader is left with an
unreadable line and none of the structured fields it paid for.

It bites hardest in mp.spawn children. Ray Train configures the worker root
logger with a message-only handler, so the parent process is already readable,
but a spawned child starts a fresh interpreter with no handlers -- Logger's
setup runs there and installs the JSON handler.

The knob is read from the environment rather than passed as an argument so that
spawned children, which inherit os.environ but not logging config, pick it up
without every spawn entrypoint having to opt in.

Also renames test_logger.py to logger_test.py: the unit-test runner's default
pattern is *_test.py, so these tests were never running.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…logging_knob

# Conflicts:
#	gigl/env/constants.py
Reuse is_env_flag_enabled for the GIGL_DISABLE_CLOUD_LOGGING gate rather than
carrying a second env-var parser, and drop the local falsy-value test now that
the helper owns that parsing. Narrows the accepted spellings to "1" and "true",
which the setup guide now states.
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.

3 participants