---
title: "Logger"
description: "Spook adds an action that turns debug logging on or off for an integration, like the Enable debug logging button on its integration page, but from an automation."
canonical_url: "https://spook.boo/logger"
---
# Logger

> Spook adds an action that turns debug logging on or off for an integration, like the Enable debug logging button on its integration page, but from an automation.

The logger integration decides how much Home Assistant writes to its log. When an integration misbehaves, its integration page has an **Enable debug logging** button: from then on, it writes down everything it does, until you select **Disable debug logging**.

That button only helps when you are there to press it. The problem that shows up at three in the morning, once a week, is over by the time you get up. Spook adds an action that does what the button does, so an automation can press it: when the integration fails, for example, with the [Integration failed to set up](https://spook.boo/other-features#integration-failed-to-set-up) trigger.

## Actions

Spook adds one action to the logger integration. You find it wherever you add an action, marked with a 👻.

### Set integration log level

Sets how much an integration logs. Debug, unless you pick another level. The same as **Enable debug logging** on the integration page, so that page shows debug logging is on, and its **Disable debug logging** button works as always.

The level is set on everything the integration logs through: the integration itself, and the libraries it names as its own. That is what the button does too.

Set the level to **Default** to stop. The integration then follows the level above it: the default in your `logger` configuration, or the one of Home Assistant. A level your `logger` configuration sets for exactly that integration comes back with the next restart.

How long the level stays is up to you:

- **Until Home Assistant restarts**: gone with the next restart.
- **Also through the next restart**: kept for one restart, then gone with the one after. This is what the button does: whatever goes wrong while Home Assistant starts is in the log too.
- **Until you change it**: kept for every restart to come.

This action is for administrators only, like the button. Your automations can always run it. So can your scripts, unless a user who is not an administrator starts one.

**How to use it**

1. Open the automation or script that should turn on debug logging, and select **Add action**.
2. Search for **log level**, and select **Logger: Set integration log level 👻**.
3. Under **Integration**, type the domain of the integration, like `hue`.
4. Optionally, pick another **Log level**, or change how long to **Keep** it.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=logger.set_integration_level) opens it in your Home Assistant, ready to run once.

**Technical details**

| Action properties |
| --- |
| Action | Logger: Set integration log level 👻 |
| Action name | `logger.set_integration_level` |
| Action targets | No targets |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=logger.set_integration_level) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=logger.set_integration_level) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `integration` | string | Yes | `hue` |
| `level` | string | No | `debug` |
| `persistence` | string | No | `once` |

The levels, most chatty first: `debug`, `info`, `warning`, `error`, `critical`, and `notset` for **Default**. How long it stays: `none` (until Home Assistant restarts), `once` (also through the next restart) and `permanent` (until you change it).

An integration Home Assistant cannot find is refused, so a typo gives you an error instead of a level nobody sees. Use the domain, the part after `/integration/` in the address of its integration page. Custom integrations work too.

**Example actions in YAML**

Turn on debug logging for an integration once it has been failing for 15 minutes, and send yourself a note:

```yaml
triggers:
  - trigger: spook.integration_failed
    options:
      for: "00:15:00"
actions:
  - action: logger.set_integration_level
    data:
      integration: "{{ trigger.domain }}"
  - action: notify.persistent_notification
    data:
      title: Debug logging on
      message: >-
        {{ trigger.title }} keeps failing, so it now writes everything to the
        log.
```

Stop debug logging for Hue again:

```yaml
action: logger.set_integration_level
data:
  integration: hue
  level: notset
```

Debug logging for the night only, gone with the next restart:

```yaml
action: logger.set_integration_level
data:
  integration: zwave_js
  persistence: none
```

**Known limitations**

- Debug logging makes the log grow fast, and can slow Home Assistant down. Set it back to **Default** once you have what you need.
- **Default** also drops a level your `logger` configuration sets for exactly that integration, until the next restart. The **Disable debug logging** button does the same.
- A level your `logger` configuration sets for that integration still counts at every start. Home Assistant then takes the chattier of the two, so a quieter level kept here gives way to a chattier one from the configuration after a restart.
- A library the integration uses, but does not name as its own, keeps its level. Set that one with the `logger.set_level` action of Home Assistant.


## Sitemap

See the full [sitemap](https://spook.boo/sitemap.md) for all pages.
