mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Polymer access to log file broken when using new log file command line (#9437)
* Changed api.py to use new log file name * Only serve log file if logs are active * Changed log file location to be in hass.data
This commit is contained in:
parent
5de39fd118
commit
26c98512c8
@ -27,6 +27,10 @@ from homeassistant.helpers.signal import async_register_signal_handling
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ERROR_LOG_FILENAME = 'home-assistant.log'
|
ERROR_LOG_FILENAME = 'home-assistant.log'
|
||||||
|
|
||||||
|
# hass.data key for logging information.
|
||||||
|
DATA_LOGGING = 'logging'
|
||||||
|
|
||||||
FIRST_INIT_COMPONENT = set((
|
FIRST_INIT_COMPONENT = set((
|
||||||
'recorder', 'mqtt', 'mqtt_eventstream', 'logger', 'introduction',
|
'recorder', 'mqtt', 'mqtt_eventstream', 'logger', 'introduction',
|
||||||
'frontend', 'history'))
|
'frontend', 'history'))
|
||||||
@ -281,6 +285,8 @@ def async_enable_logging(hass: core.HomeAssistant, verbose: bool=False,
|
|||||||
logger.addHandler(async_handler)
|
logger.addHandler(async_handler)
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
|
# Save the log file location for access by other components.
|
||||||
|
hass.data[DATA_LOGGING] = err_log_path
|
||||||
else:
|
else:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Unable to setup error log %s (access denied)", err_log_path)
|
"Unable to setup error log %s (access denied)", err_log_path)
|
||||||
|
@ -13,7 +13,7 @@ import async_timeout
|
|||||||
|
|
||||||
import homeassistant.core as ha
|
import homeassistant.core as ha
|
||||||
import homeassistant.remote as rem
|
import homeassistant.remote as rem
|
||||||
from homeassistant.bootstrap import ERROR_LOG_FILENAME
|
from homeassistant.bootstrap import DATA_LOGGING
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_STOP, EVENT_TIME_CHANGED,
|
EVENT_HOMEASSISTANT_STOP, EVENT_TIME_CHANGED,
|
||||||
HTTP_BAD_REQUEST, HTTP_CREATED, HTTP_NOT_FOUND,
|
HTTP_BAD_REQUEST, HTTP_CREATED, HTTP_NOT_FOUND,
|
||||||
@ -51,8 +51,9 @@ def setup(hass, config):
|
|||||||
hass.http.register_view(APIComponentsView)
|
hass.http.register_view(APIComponentsView)
|
||||||
hass.http.register_view(APITemplateView)
|
hass.http.register_view(APITemplateView)
|
||||||
|
|
||||||
hass.http.register_static_path(
|
log_path = hass.data.get(DATA_LOGGING, None)
|
||||||
URL_API_ERROR_LOG, hass.config.path(ERROR_LOG_FILENAME), False)
|
if log_path:
|
||||||
|
hass.http.register_static_path(URL_API_ERROR_LOG, log_path, False)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user