blacklight / platypush

A versatile and extensible platform for automation with hundreds of supported integrations
https://platypush.tech
MIT License
288 stars 21 forks source link

Logging Config #162

Closed ChrisDodgeRR closed 3 years ago

ChrisDodgeRR commented 3 years ago

Trying to setup logging so that it is less verbose, so my config.yaml contains:

logging:
    level: WARNING
    filename: /etc/platypush/log/platypush.log

However the logging level is ignored as __init__.py explicitly sets the log level to INFO on line 30.

Removing this line on my setup basically works as intended, though some INFO log messages do still come through, for example:

2020-12-29 15:20:18,477| INFO|werkzeug|192.168.86.241 - - [29/Dec/2020 15:20:18] "POST /execute HTTP/1.1" 200 -
2020-12-29 15:20:18,478| INFO|werkzeug|192.168.86.241 - - [29/Dec/2020 15:20:18] "POST /execute HTTP/1.1" 200 -
2020-12-29 15:21:27,063| INFO|werkzeug|192.168.86.241 - - [29/Dec/2020 15:21:27] "POST /execute HTTP/1.1" 200 -

I've just started experimenting with it, and it seems to do exactly what I want, so many thanks!

blacklight commented 3 years ago

Very good point. I haven't been overriding the logging level for a long time and I've missed the fact that we were still defaulting it to INFO - I have fixed it now.

The log lines you posted come from the Flask web service, which by default logs all the calls to the endpoints. There may be other external dependencies that have their own logging policies as well (openzwave is another one of those for example) and should probably be tackled with custom logging override.