Enable duplicated log file on supervised when env var is set#158679
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enables Home Assistant to create duplicate log files on supervised installations when the HA_DUPLICATE_LOG_FILE environment variable is set. Previously, supervised installations never created log files locally. This change provides flexibility for users who want local log files while running under Supervisor.
Key changes:
- Modified bootstrap logic to check for
HA_DUPLICATE_LOG_FILEenvironment variable before skipping log file creation on supervised installations - Updated tests to parameterize the supervisor logging test, covering both scenarios (with and without the environment variable)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| homeassistant/bootstrap.py | Added check for HA_DUPLICATE_LOG_FILE environment variable to conditionally enable log file creation on supervised installations |
| tests/test_bootstrap.py | Parameterized the supervisor logging test to verify behavior with and without the HA_DUPLICATE_LOG_FILE environment variable |
| if "SUPERVISOR" in os.environ: | ||
| _LOGGER.info("Running in Supervisor, not logging to file") | ||
| if "SUPERVISOR" in os.environ and "HA_DUPLICATE_LOG_FILE" not in os.environ: | ||
| _LOGGER.info( |
There was a problem hiding this comment.
Why do we even log this? (before this change).
There was a problem hiding this comment.
To make it easier for someone looking for the log file to understand why it is gone.
There was a problem hiding this comment.
But I've removed it now, since it does not show up unless -v is pass to hass.
|
@MartinHjelmare docs are not missing: home-assistant/developers.home-assistant#2888 |
|
We shouldn't mention this CLI option in any user docs? |
|
Docs added: home-assistant/home-assistant.io#42625 |
Proposed change
Implements support for the env var added in home-assistant/supervisor#6400
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: