Recommendations for logging?

Hi,

I start to dive deeper into AppDaemon automations and the logging in the Addon / Log section of the GUI is annoying.

Hence, I started to separate the logs into own files for every automation file/class I created.

Then I realised the errors are not written into the separated log files. Of course, but it’s bad, as it leads to missed errors when working on an automation.

Hence, I configured the default logging files to be also in the same directory.

Ok, now again the errors are again in a separate file… Also not ideal. Also the logging is not shown in the Web GUI anymore!

Hence, I configured all the default files to write into the same file. Accepting it’s not in the Web GUI anymore.

Even following the file with tail -f addon_configs/a0d7b954_appdaemon/logs/appdaemon.log it doesn’t show the errors, as I have smb shared the config dirs and mounted them on my desktop to open them together in a Visual Studio Code project, and it seems the log files are only flushed after some lines…

Hmmm. Far from ideal working experience.

How are you logging and setting up your development environment with AppDaemon?

I recommend you have 2 main log files, appdaemon.log and error.log. Make sure your apps are not overly verbose. This way you don’t have to look at several different log files to know what is going on with your apps.

You can set the minimum log level for each app by setting log_level in the YAML file. I will usually keep my log level at DEBUG until I have finished debugging my app, then switch to INFO or higher. I will only create a separate log file for a specific app if it’s overly verbose and I need to save the data.

IMO, keep it simple. Hopefully that helps.

1 Like

Thanks @proggie ,

Sounds close to what I like. But I guess there is no way to have errors in an extra file, but still in the main logging (or individual logging file configured for one app)?

I find it’s really complicating things if the error is not in the midst of the other logging. One has to rely on time stamps to search things together, which is another source of errors in my opinion.