Home Assistant Community

Combining AppDaemon log and main Hass log

#1

My Hass.io setup is approaching almost 50% AppDaemon scripts, and I wish that it was easier to see AD logs. I love the real-time Log Viewer addon in Hass.io and use it all the time to monitor everything else, but the only entries that I see for AD are some calls back to the main Hass core. Logging into my Linux box to run a “tail -f” is a lot less friendly and practically unusable from a mobile device. I’d really like to be able to redirect all AppDaemon logs back to the main homeassistant.log, or be able to choose what to inject. If there’s no native capability, perhaps there could be an intermediary that reads from the AD log and injects into the Hass log.

The lack of hits in my search attempts makes me think that I’m the only one who wants this, but maybe I missed something. Is there anything like this?

Adding logs from AppDaemon to the main home_assistant.log
#2

In the absence of a better solution, I’m using this python script as a service called “log”:

component = data.get('component')
if not component:
logger.error('No component provided')

message = data.get('message')
if not message:
logger.error('No message provided')

complete_msg = "{}: {}".format(component, message)

logger.info(complete_msg)

And calling it like this in an AppDaemon app:

 self.call_service("python_script/log", component = "test",
   message = "Test Message")

Is there a better way? Or a better place to post this?