appdaemon icon indicating copy to clipboard operation
appdaemon copied to clipboard

Issue logging DEBUG level log entries

Open paulwarwicker opened this issue 1 year ago • 2 comments

What happened?

Firstly, thank you for making this available. I have absolutely everything defined in code and would not be able achieve the level of control I have in my automation.

I think there may be an issue with the log() method. I have been trying to log DEBUG level messages to the logging. DEBUG and NOTSET do not appear to be logged even if the log level is explicitly set. All the other levels work OOTB.

There is DEBUG output present in the logfile but these come from appdaemon itself.

Version

4.4.2

Installation type

Docker container

Relevant log output

2023-12-02 21:29:00.751660 CRITICAL automation: testing CRITICAL
2023-12-02 21:29:00.754663 ERROR automation: testing ERROR
2023-12-02 21:29:00.755874 WARNING automation: testing WARNING
2023-12-02 21:29:00.758563 INFO automation: testing INFO

Relevant code in the app or config file that caused the issue

        runtime = datetime.time(0, 0, 0)
        self.set_log_level('DEBUG') # or NOTSET
        self.run_minutely(self.log_test, runtime)

    def log_test(self, kwargs):
        for level in ['CRITICAL','ERROR','WARNING','DEBUG','NOTSET','INFO']: # INFO comes last to ensure we have a final successfully logged entry
            self.log(f'testing {level}', level=level)

Anything else?

Also I think there is a documentation error. The docs say that the default level is WARNING. I believe it should be INFO.

paulwarwicker avatar Dec 02 '23 22:12 paulwarwicker

Yes, I came across that doc error just yesterday funnily enough. I'll take a look at the levels issue as well, thanks.

acockburn avatar Dec 04 '23 14:12 acockburn

@acockburn I have just noticed that my logging entries are being added if I list the container log directly. Initially I was using the web interface and they are definitely not shown there. Presumably you choose to ignore these because it can be a bit too much at times, especially if you configure to run hourly or minutely.

Is there a way to configure the log level in the web interface?

-paul

paulwarwicker avatar Dec 11 '23 13:12 paulwarwicker