Best Practices for setting up logging

Is logging a device a load concern? I often see options for...

debug logging and description text logging...

My assumption was they would really only be needed if there was an issue. Then I could turn them on. However, when I disable them, I still see...

Description logging is: disabled is disabled warnings in the log which is counterproductive.

Thoughts...guidelines

Thanks!

Debug logging would be unnecessary normally.

Rule machine - I'll normally switch on logging in rule machine rules when I create a new rule. Once I see the rule is running normally I'll switch the logging off, turning it back on again if I experience any issues later down the line.

Devices - there are some that I have description text logging on for, where I might want to quickly check when something has been switched on/off without going into the device page events tab. I make sure that everything that reports frequently like a power, motion or illuminance has logging disabled.

1 Like

This should only happen once whenever you hit "Save Preferences" on the device detail page. Think of it as an FYI for that moment in time. You will not see these entries generated over time.

Adding to the above, note that debug logging is enabled by default for 30 minutes after adding a new device and also for 30 minutes any tine you manually enable it. Thus, you'll normally find this option disabled. It's mostly useful for troubleshooting if a driver isn't working as you expect (probably why it's enabled for a bit to start).

Description text logging normally logs device events (though note that "Events" is the authoritative source for this, even if it normally matches--logging is under the control of the driver ultimately, not the platform). This is enabled by default and does not automatically turn off. Whether you want to keep it is a matter of preference. I normally find it helpful since it can assist with troubleshooting apps or devices, especially if relative timing is important, without needing to look at the device itself.

That's for devices, and really only stock drivers at that. Community code may vary, though IMHO good code follows these conventions. Apps tend to have their own, varied options but usually nothing enabled by default. If you're having trouble with an app, enabling logging is a good first step to figuring it out. Otherwise, the defaults are probably fine--but it's up to you.

Impact on your hub is negligible. The main reason you might want to disable any logging is because Past Logs has a size-based limit, and if you're trying to troubleshoot something that already happened, excessive logging may make that harder. Normally, this is of little concern. Some people also think limiting past logs make it easier to read; however, there are various search and filter options available to help with that (including displaying only certain apps or devices), so I don't consider that a good reason on its own.

2 Likes

Thanks. The Homeseer 300 dimmer driver starts with both enable. I'd been turning anything I didn't currently care about to off and was just surprised to warnings in the log for doing so. As I said, that seems very counterproductive. This is a brand-new build and just want to make it as clean as possible.

THANKS...good to know!

1 Like

You'll find a message in the logs (which happens to be labeled as a warning, maybe to make it stand out a bit) either way. :slight_smile: Again, just once, whenever you save preferences.

Right, this is the standard behavior I described above.

I felt this was odd as well, but had been copying the sample drivers so had it in all my drivers. I have since re-thought all of my logging and changed this log entry to an Info log on any of the more recently updated drivers. Not just simply changed it, but the logging setup was totally re-written. Has not made its way to my Zooz switch driver yet.

Gave it a proper log level drop down menu so you can even disable any warn logs if you are so inclined by selecting only error logging.