tsightler / ring-mqtt

Ring devices to MQTT Bridge
MIT License
556 stars 100 forks source link

Support: Getting debug logging even though debug logging not enabled #799

Closed fender4645 closed 4 months ago

fender4645 commented 4 months ago

Describe the Issue

It's very possible there's an issue on my end that I'm missing. I've been using this for 5+ years so I'm wondering if it's something I enabled years ago and don't remember. But I've always been getting debug output (for all categories) for as long as I can remember. This causes the docker logs to grow to almost a gig in size. I've verified both in my docker-compose file and within the container that the DEBUG env variable is not set. Is there any place else this could be configured?

Steps take so far

Validated it's not set in my compose file not inside the container itself

Log Output

Output from printenv inside the container:


$ docker exec -it ring-mqtt /bin/bash
root@31ed2446ef38:/$ printenv
S6_SERVICES_GRACETIME=10000
S6_BEHAVIOUR_IF_STAGE2_FAILS=2
MQTTRINGTOPIC=ring
PUID=1000
CHARSET=UTF-8
HOSTNAME=31ed2446ef38
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
PWD=/
MQTTHOST=192.168.2.200
TZ=America/Los_Angeles
HOME=/root
LANG=C.UTF-8
MQTTPORT=1883
TERM=xterm-256color
SHLVL=1
MQTTUSER=********
MQTTPASSWORD=********
PS1=$(whoami)@$(hostname):$(pwd)$
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
S6_CMD_WAIT_FOR_SERVICES=1
GUID=1000
MQTTHASSTOPIC=hass/status
RINGTOKEN=********
_=/bin/printenv

Docker compose file:

version: "3"
services:
  ring-mqtt:
    image: tsightler/ring-mqtt
    container_name: ring-mqtt
    volumes:
      - /opt/ring-mqtt:/data
    environment:
      - PUID=1000
      - GUID=1000
      - TZ=America/Los_Angeles
      - MQTTHOST=192.168.2.200
      - MQTTPORT=1883
      - MQTTRINGTOPIC=ring
      - MQTTHASSTOPIC=hass/status
      - MQTTUSER=********
      - MQTTPASSWORD=********
      - RINGTOKEN=********
    restart: unless-stopped

Snippet from beginning of log:

Running ring-mqtt...
2024-01-05T00:33:20.238Z ring-mqtt Detected runmode: docker
2024-01-05T00:33:20.239Z ring-mqtt Configuration file: /data/config.json
2024-01-05T00:33:21.467Z ring-mqtt Reading latest data from state file: /data/ring-state.json
2024-01-05T00:33:21.490Z ring-mqtt MQTT URL: mqtt://********:********@192.168.2.100:1883
2024-01-05T00:33:21.511Z ring-mqtt Attempting connection to Ring API using saved refresh token...
2024-01-05T00:33:24.085Z ring-mqtt Successfully established connection to Ring API using saved token
2024-01-05T00:33:24.086Z ring-mqtt Received updated refresh token
2024-01-05T00:33:24.086Z ring-mqtt Saving updated refresh token to state file
2024-01-05T00:33:25.108Z ring-mqtt Successfully saved updated state file: /data/ring-state.json
2024-01-05T00:33:26.089Z ring-mqtt Attempting connection to MQTT broker...
2024-01-05T00:33:26.155Z ring-mqtt MQTT connection established, processing Ring locations...

### Screenshots

_No response_

### Config File

```shell
{
    "mqtt_url": "mqtt://********:********@192.168.2.100:1883",
    "mqtt_options": "",
    "livestream_user": "",
    "livestream_pass": "",
    "disarm_code": "********",
    "enable_cameras": false,
    "enable_modes": false,
    "enable_panic": false,
    "hass_topic": "homeassistant/status",
    "ring_topic": "ring",
    "location_ids": [
        ""
    ]
}

Install Type

Docker

Version

5.6.3

Operating System

Ubuntu

Architecture

x86_64

tsightler commented 4 months ago

I'm sorry but it's not really clear to me what your question is or what problem you are having. Can you please clarify what problem you are having as your notes talk about logs, state that you have always had logs, and then show a snippet with logs working as expected if nothing is set, thus I don't see any actual problem.

tsightler commented 4 months ago

OK, sorry, I only read the description, but not the title, so your issue is that you don't want debug logging, which is fine, but, as stated in the documentation, the Docker version defaults to "ring-*" if DEBUG isn't defined, so the behavior you describe is as expected. Simply define DEBUG to anything else, for example, DEBUG="disabled" although theoretically, even using DEBUG='' should work, and it will disable logging.

fender4645 commented 4 months ago

Sigh. I missed that line in the docs about DEBUG being on by default. Changed it and now it looks good. Will this disable all logging? I was hoping for a middle-ground like INFO or WARNING. Either way, appreciate your help and this project.

tsightler commented 4 months ago

The docs cover the categories of messages you can select. Right now there are no "INFO" or "WARNING" message categories, and I doubt there will ever be. Errors outside of ring-mqtt (from Node itself for example) will always be logged, the DEBUG environment variable only controls what message types from ring-mqtt will be logged.

Realistically, I don't really understand the concern about log size since log rotation and maximum log size is easily configured in Docker itself, either globally or on a per-container basis, so you don't have to keep any more logs than you want to.