Better Logging for AppDaemon Apps

Not sure if this has been posted here before, but hats off to Jason Antman, who’s come up with a pretty awesome, more Pythonic way of logging in AppDaemon apps: Better Logging for AppDaemon Apps - Jason Antman's Blog. In summary:

So far this seems to be working quite well for me, and allowing me to have a much better experience with developing, debugging and testing AppDaemon apps. Perhaps it will be useful to someone else as well.

1 Like

I’m going to try that out for sure.

Another tip for those using hass.io:

watching logs over samba mounted dir is very slow for me thus I do this instead:

Enable logging in appdaemon.yaml:

log:
  logfile: /config/appdaemon/appdaemon.log
  errorfile: /config/appdaemon/appdaemon.log

Get access to ssh to hass.io as described at https://developers.home-assistant.io/docs/en/hassio_debugging.html

then you can do as follows:

$ ssh [email protected] -p 22222
$ login
$ docker exec -it `docker ps -aqf "ancestor=hassioaddons/appdaemon3-armhf"` /bin/bash
$  tail -f /config/appdaemon/appdaemon.log

this gives instant feedback as opposed to several seconds and sometimes no updates when using tail -f on smb mounted directories.

its going from the wrong assumption that you cant set levels in the log.
i think thats strange because the docs clearly state that you can set levels.

I saw that article, and I am thinking of ways to integrate this - my original goal was simplicity, and the ability to be explicit about which app was logging, it can definitely be improved on though.

1 Like

Btw. I tried using it but stopped as it for some reason stopped normal logging and exceptions was no longer printed.