2019-06-27 20:10:56 -07:00

3.2 KiB

layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category, ha_qa_scale, ha_release
layout title description date sidebar comments sharing footer logo ha_category ha_qa_scale ha_release
page Logger Instructions on how to enable the logger integration for Home Assistant. 2015-11-12 17:00 true false true true home-assistant.png
Utility
internal 0.8

The logger integration 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.yaml file:

# Example configuration.yaml entry
logger:

To log all messages and ignore events lower than critical for specified components:

# 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 components:

# 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 SmartThings lights
    homeassistant.components.smartthings.light: info

    # log level for a custom component
    custom_components.my_integration: debug

    # log level for the `aiohttp` Python package
    aiohttp: error

{% configuration %} default: description: Default log level. required: false type: 'log_level' default: debug logs: description: List of integrations and their log level. required: false type: map keys: '<component_namespace>': description: Logger namespace of the component. type: 'log_level' {% endconfiguration %}

{% linkable_title Log Levels %}

Possible log severity levels, listed in order from most severe to least severe, are:

  • critical
  • fatal
  • error
  • warning
  • warn
  • info
  • debug
  • notset

{% linkable_title Services %}

{% linkable_title Service set_default_level %}

You can alter the default log level (for integrations without a specified log level) using the service logger.set_default_level.

An example call might look like this:

service: logger.set_default_level
data:
  level: info

{% linkable_title Service set_level %}

You can alter log level for one or several integrations using the service logger.set_level. It accepts the same format as logs in the configuration.

An example call might look like this:

service: logger.set_level
data:
  homeassistant.core: fatal
  homeassistant.components.mqtt: warning
  homeassistant.components.smartthings.light: info
  custom_components.my_integration: debug
  aiohttp: error

The log information are stored in the configuration directory as home-assistant.log and you can read it with the command-line tool cat or follow it dynamically with tail -f.

If you are a Hassbian user you can use the example below:

$ tail -f /home/homeassistant/.homeassistant/home-assistant.log

If you are a Hass.io user, you can use the example below, when logged in through the SSH add-on:

$ tail -f /config/home-assistant.log