Skip to content

Add set_default_level documentation #5460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 47 additions & 10 deletions source/_components/logger.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ logo: home-assistant.png
ha_category: "Utility"
---

The logger component lets you define the level of logging activities in Home Assistant.
The `logger` component lets you define the level of logging activities in Home Assistant.

To enable the logger in your installation, add the following to your `configuration.yaml` file:
To enable the `logger` component in your installation, add the following to your `configuration.yaml` file:
Copy link
Member

Choose a reason for hiding this comment

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

This sentence ends with a :, but so does the next? Aren't both saying almost the same thing?
IMHO those 2 need to be combined in 1 logical sentence...


To have a full log and log everything only this entry is needed (without any qualifier):
```yaml
# Example configuration.yaml entry
logger:
```
To log all messages and ignore events lower than critical for specified components.

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

```yaml
# Example configuration.yaml entry
Expand All @@ -30,7 +31,7 @@ logger:
homeassistant.components.camera: critical
```

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

```yaml
# Example configuration.yaml entry
Expand All @@ -43,7 +44,25 @@ logger:
homeassistant.components.camera: critical
```

Possible log severities are:
{% configuration %}
default:
description: Default log level.
required: false
type: '[log_level](#log-levels)'
default: debug
logs:
description: List of components and their log level.
required: false
type: map
keys:
'<component_namespace>':
description: Logger namespace of the component.
type: '[log_level](#log-levels)'
{% endconfiguration %}

### {% linkable_title Log Levels %}

Possible log severity levels are:

- critical
- fatal
Expand All @@ -53,11 +72,26 @@ Possible log severities are:
- info
- debug
- notset


## {% linkable_title Services %}

### {% linkable_title Service `set_default_level` %}

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

An example call might look like this:

```yaml
service: logger.set_default_level
data:
level: info
```

### {% linkable_title Service `set_level` %}

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

An example call might look like this:

Expand All @@ -68,15 +102,18 @@ data:
homeassistant.components.media_player.yamaha: debug
```

The log information are stored in the [configuration directory](/docs/configuration/) as `home-assistant.log` and you can read it with the command-line tool `cat` or follow it dynamically with `tail -f`.
The log information are stored in the [configuration directory](/docs/configuration/)
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:

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

If you are a Hass.io user you can use the example below, whenlogged in through the ssh addon:
If you are a Hass.io user, you can use the example below, when logged in through
the [SSH add-on](/addons/ssh/):

```bash
$ tail -f /config/home-assistant.log
Expand Down