Skip to content

bug: LOG_UTC is an unnamespaced environment variable #394

Description

@codeforester

Problem

CliFormatter reads LOG_UTC from the process environment
(lib/python/base_cli/logging.py:193):

self.use_utc = use_utc if use_utc is not None else os.environ.get("LOG_UTC") == "1"

LOG_UTC is a generic, unnamespaced name. Every other base-cli-specific environment variable is
prefixed, and the only unprefixed names the package reads otherwise are recognized cross-tool
standards (NO_COLOR, XDG_CACHE_HOME, XDG_CONFIG_HOME, LOCALAPPDATA, APPDATA, SHELL,
COMSPEC):

$ grep -rhoE "BASE_CLI_[A-Z_]+" lib/python/base_cli/ | sort -u
BASE_CLI_CACHE_DIR   BASE_CLI_COLOR   BASE_CLI_CONFIG_DIR   BASE_CLI_DISPLAY_COMMAND

LOG_UTC is not a standard. Any unrelated tool, CI image, or shell profile that exports LOG_UTC=1
silently changes the timestamp format of every base-cli CLI on that machine, and the log timestamps
are part of the retained diagnostic bundle. It is also undocumented: it appears in no file under
docs/.

Verified evidence

Reviewed 2026-09-30 at a58ec109349fa3f3d03eae5b0de078b39ea361a2.

os.environ["LOG_UTC"] = "1"
CliFormatter().use_utc -> True
$ grep -rn "LOG_UTC" docs/
(no matches)

Proposal

  1. Read BASE_CLI_LOG_UTC as the supported name.
  2. Continue honouring LOG_UTC for one release with a BaseCliDeprecationWarning (the project
    already has deprecations.deprecated() and a documented policy in docs/api-stability.md), then
    remove it.
  3. Document both the variable and the full environment surface. There is currently no single page
    listing the environment variables base-cli reads; adding one to docs/integrations.md would also
    serve the other env-var work.

Acceptance criteria

  • BASE_CLI_LOG_UTC controls UTC timestamps.
  • LOG_UTC still works but warns, with the removal release named.
  • One documentation page lists every environment variable base-cli reads, its meaning, and its
    default.

Non-goals

  • Do not change the default timestamp format or the datefmt strings.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type

Projects

  • Status
    In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions