Skip to content

listen_log requires log parameter (doesn't default to all logs as documented) #2666

Description

@danVnest

What happened?

The documentation says listen_log's log parameter is optional:

Name of the log to listen to, default is all logs. The name should be one of the 4 built in types main_log, error_log, diag_log or access_log or a user defined log entry.

However, it only seems to work when a specific log type is provided.

For example:
log_listeners = self.listen_log(self.handle_logged_issue, "WARNING") never triggers the callback, but
log_listeners = self.listen_log(self.handle_logged_issue, "WARNING", log="main_log") triggers the callback as expected

Side note: the documentation says listen_log returns "a handle", but it returns a list of handles. The examples also imply only a single handle is returned.

Version

4.5.13

Installation type

Home Assistant add-on

Relevant log output

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

I have tested with the following in appdaemon.yaml:

logs:
  main_log:
    filename: /config/logs/main.log
    filter_threshold: 5
  error_log:
    filename: /config/logs/errors.log
  diag_log:
    filename: /config/logs/diag.log
  access_log:
    filename: /config/logs/access.log

and also with all of that omitted (logging to STDOUT by default, showing in Home Assistant's app logs).

Anything else?

I'm happy to provide example code and logs if you can't replicate this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issueSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions