Skip to content

Enable duplicated log file on supervised when env var is set#158679

Merged
abmantis merged 6 commits into
devfrom
enable_duplicated_log_file
Dec 17, 2025
Merged

Enable duplicated log file on supervised when env var is set#158679
abmantis merged 6 commits into
devfrom
enable_duplicated_log_file

Conversation

@abmantis
Copy link
Copy Markdown
Member

@abmantis abmantis commented Dec 10, 2025

Proposed change

Implements support for the env var added in home-assistant/supervisor#6400

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant home-assistant Bot added cla-signed core new-feature small-pr PRs with less than 30 lines. labels Dec 10, 2025
@abmantis abmantis marked this pull request as ready for review December 11, 2025 11:45
@abmantis abmantis requested a review from a team as a code owner December 11, 2025 11:45
Copilot AI review requested due to automatic review settings December 11, 2025 11:45
Comment thread homeassistant/bootstrap.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_FILE environment 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

Comment thread homeassistant/bootstrap.py Outdated
Comment thread homeassistant/bootstrap.py Outdated
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(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we even log this? (before this change).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

To make it easier for someone looking for the log file to understand why it is gone.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But I've removed it now, since it does not show up unless -v is pass to hass.

Comment thread homeassistant/bootstrap.py Outdated
Comment thread homeassistant/bootstrap.py Outdated
@MartinHjelmare MartinHjelmare marked this pull request as draft December 16, 2025 17:27
@abmantis
Copy link
Copy Markdown
Member Author

@MartinHjelmare
Copy link
Copy Markdown
Member

We shouldn't mention this CLI option in any user docs?

@abmantis abmantis marked this pull request as ready for review December 17, 2025 15:18
@abmantis
Copy link
Copy Markdown
Member Author

Docs added: home-assistant/home-assistant.io#42625

@abmantis abmantis merged commit f0a5e0a into dev Dec 17, 2025
66 checks passed
@abmantis abmantis deleted the enable_duplicated_log_file branch December 17, 2025 17:44
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants