maxbec / hassio-diyHue

Fully configurable diyHue add-on for home-assistant.
30 stars 17 forks source link

Stop logging to the syslog #41

Open SvenGWK opened 2 years ago

SvenGWK commented 2 years ago

Hello, first of all thank you for this integration.

If this is a stupid question, I apologize in advance. I don't have much knowledge about docker...

The integration floods /var/log/syslog with this information even if debug is turned off:

A
{'alert': 'select',
 'bri': 171,
 'colormode': 'xy',
 'ct': 500,
 'mode': 'homeautomation',
 'on': False,
 'reachable': False,
 'xy': [0.599, 0.382]}
A
{'alert': 'select',
 'bri': 166,
 'colormode': 'xy',
 'ct': 500,
 'mode': 'homeautomation',
 'on': False,
 'reachable': False,
 'xy': [0.599, 0.382]}

The log file is already over 100Mb after one day.

I tried

logger:
  default: critical
  logs:
    custom_component.590f8686_diyhue-beta-branch: critical

in configuration.yaml, but without success.

The container seems to be configured for logging to the syslog, right?

docker inspect -f '{{.HostConfig.LogConfig.Type}}' addon_590f8686_diyhue-beta-branch
journald

How can I turn this off?

Thank you.

foxy82 commented 2 years ago

At a very quick glance it looks like the beta branch of diyhue has logging set to debug: https://github.com/diyhue/diyHue/blob/beta/BridgeEmulator/logManager/logger.py

The change would need to be made in that project.

SvenGWK commented 2 years ago

Thanks, that probably explains it. Naively as I wanted to approach the issue I logged into the container as root and changed logging. DEBUG to logging.WARNING. But after restarting the addon it still pushed everything to syslog.

I think that's not how it works with Docker ;-) Well, I'll try a little on it, can obviously learn something new there.

SvenGWK commented 2 years ago

Hmm, I have now forked both repos. In the diyHue Beta I changed the entry from DEBUG to WARNING and in the Dockerfile of the integration I bent the path for the tarball to "my" diyhue repo. Then I included the repo in the Homeassistant and reinstalled from there. When I log into the newly built container, my change is visible there as well. Unfortunately, nothing has changed in the log behavior. I will ask @DiyHue what else it could be.

SvenGWK commented 2 years ago

@foxy82 mariusmotea replied me the following: "Can you somehow set ENV variable DEBUG=false ? I don't use Home Assistant plugin, but i know the addon is a docker container and we implemented DEBUG env flag to enable debug mode."

I have added ENV DEBUG=false to the "Other settings" section of the dockerfile and reinstalled the integration. After the startup I find in the log the information that debug logging is disabled, but still everything is logged and ends up in the syslog file. Is there another possibility to pass the ENV variable?

Mevel commented 2 years ago

I would like to invite you to the official diyhue-hassio addon repo found here

https://github.com/diyhue/hassio-addon

it is based upon this repo and will be maintained officially.

In the meantime we fixed the issue.

https://github.com/diyhue/diyHue/commit/b9c9b829d2dcfb2040c35aabd560f75026037f61