Logger
The Logger integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] lets you define the level of logging activities in Home Assistant.
To enable the logger integration in your installation,
add the following to your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file:
# Example configuration.yaml entry
logger:
The log severity level is warning if the logger integration is not enabled in configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more].
To log all messages and ignore events lower than critical for specified integrations:
# Example configuration.yaml entry
logger:
default: info
logs:
homeassistant.components.yamaha: critical
custom_components.my_integration: critical
To ignore all messages lower than critical and log event for specified integrations:
# Example configuration.yaml entry
logger:
default: critical
logs:
# log level for HA core
homeassistant.core: fatal
# log level for MQTT integration
homeassistant.components.mqtt: warning
# log level for all python scripts
homeassistant.components.python_script: warning
# individual log level for this python script
homeassistant.components.python_script.my_new_script.py: debug
# log level for SmartThings lights
homeassistant.components.smartthings.light: info
# log level for a custom integration
custom_components.my_integration: debug
# log level for the `aiohttp` Python package
aiohttp: error
# log level for both 'glances_api' and 'glances' integration
homeassistant.components.glances: fatal
glances_api: fatal
The log entries are in the form
timestamp log-level thread [namespace] message
where namespace is the <component_namespace> currently logging.
Configuration Variables
Default log level. See log_level.
List of integrations and their log level.
Logger namespace of the integration. See log_level.
Regular Expression logging filters.
Logger namespace of the integration and a list of Regular Expressions. See Log Filters.
In the example, do note the difference between ‘glances_api’ and ‘homeassistant.components.glances’ namespaces, both of which are at root. They are logged by different APIs.
If you want to know the namespaces in your own environment then check your log files on startup.
You will see INFO log messages from homeassistant.loader stating loaded <component> from <namespace>.
Those are the namespaces available for you to set a log level against.
Log levels
Possible log severity levels, listed in order from most severe to least severe, are:
- critical
- fatal
- error
- warning
- warn
- info
- debug
- notset
Log filters
Service-specific Regular Expression filters for logs. A message is omitted if it matches the Regular Expression.
An example configuration might look like this:
# Example configuration.yaml entry
logger:
default: info
logs:
custom_components.my_integration: critical
filters:
custom_components.my_integration:
- "HTTP 429" # Filter all HTTP 429 errors
- "Request to .*unreliable.com.* Timed Out"
homeassistant.components.nws:
- "^Error handling request$"
Actions
Action: Set default level
The logger.set_default_level action alters the default log level (for integrations without a specified log
level).
An example call might look like this:
action: logger.set_default_level
data:
level: info
Action: Set level
The logger.set_level action alters the log level for one or several integrations.
It accepts the same format as logs in the configuration.
An example call might look like this:
action: logger.set_level
data:
homeassistant.core: fatal
homeassistant.components.mqtt: warning
homeassistant.components.smartthings.light: info
custom_components.my_integration: debug
aiohttp: error
Viewing logs
The primary way to view logs is through the Home Assistant UI. Go to Settings > System > Logs and select Home Assistant Core. To see the full unformatted log output, enable Show raw logs at the top of the page. You can also download the log file from this page.
Viewing logs on Home Assistant OS
On Home Assistant Operating SystemHome Assistant OS, the Home Assistant Operating System, is an embedded, minimalistic, operating system designed to run the Home Assistant ecosystem on single board computers (like the Raspberry Pi) or Virtual Machines. It includes Home Assistant Core, the Home Assistant Supervisor, and supports apps. Home Assistant Supervisor keeps it up to date, removing the need for you to manage an operating system. Home Assistant Operating System is the recommended installation type for most users. installations, logs are not written to a file in the configuration directory. Use the UI as described above, or run the following command from the SSH app for Home Assistant:
ha core logs --follow
Viewing logs on Container installations
For Home Assistant ContainerHome Assistant Container is a standalone container-based installation of Home Assistant Core. Any OCI compatible runtime can be used, but the documentation focus is on Docker. [Learn more] installations, the log information is also written to a file called home-assistant.log in the configuration directory. You can follow it dynamically with the following command:
# Follow the log dynamically
docker logs --follow MY_CONTAINER_ID
Or read the file directly:
tail -f /config/home-assistant.log