How to configure logging

I’m having trouble determining how to configure the logging in HA. I’ve read through https://www.home-assistant.io/integrations/logger/, but what that doesn’t describe well is how to determine what the name should be if you want to set logging levels on a specific component. For example, I want to set to debug for the MyQ integration, do I put “myq”, “homeassistant.core.myq”, something else entirely?

1 Like

What’s the name that appears in the log inside the brackets? Example, this a log line:

2021-01-04 13:38:26 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=51 from 2020-12-21 15:54:15.455109)
                                        \                               /
                                         -------name you use------------
1 Like

for myq integration it’s most likely homeassistant.components.myq by the way.

I guess that is part of the problem, there isn’t anything in the log for the item yet, but it isn’t working. So is the only way to determine what it should be to set the whole system to debug for a bit and hope something shows up to copy that name from?

yeah that’s if it has logging. As a sidebar, the myq integration is always breaking. This is because myq doesn’t have a published API for ‘people like us’ and it has to be reverse engineered. They also constantly change the API, which causes the break. Personally, I’m convinced they do this because they have a subscription base and changing the API stops ‘people like us’ getting around the payment. This may be a hard pill to swallow, but I personally avoided myq because of this and went with a custom solution. I know many others who have done the same.

Yes, I completely agree on the MyQ, actually working on a different solution. MyQ was just the first module that came to mind. The one I’m looking to get logs for is TP-Link/Kasa as one of my switches randomly won’t come back available.

Yep, then turn on system wide debugging and find the lines you care about. Then revert and add said configuration to the logger. That’s what I do. Pretty much any integration will have this logging: homeassistant.components.<integrationname>. The name of the integration is the name of the folder it resides in on the home assistant github page. But most components/integrations use other python libraries. The only way to get those logs is to turn on debugging and grab the name in the brackets.

Thanks for the help

Hi guys,
Is it possible ? if so how I can set log level for home-assistant-libs

I would be happy to see debug level log entries of

I tried with diffrent logger configuration and expect to see log in System → HomeAssistant Core but I see nothing related to aioshelly

I did some tries with:

    home-assistant-libs.aioshelly: debug
    aioshelly: debug
    aioshelly.block_device: debug
    aioshelly.aioshelly.block_device: debug
    aioshelly.coap: debug

it would most likely be

homeassistant.components.shelly.aioshelly

but it’s not apart of the package, so it could just be

aioshelly

The only way to see what it actually is, is to view your TEXT logs. Not the system → log page.

Jumping in here - in HA now days, one can enable debug logging by simply clicking on the three dots on the integration card. Is this in addition to, or an alternativ to use configuration.yam

logger:
   default: warning
   logs:
   homeassistant.components.cover: debug