AnotherDaniel / smahub

SMAHub is a flexible and modular solution for collecting data from SMA photovoltaic (PV) products and publishing it to various output channels, such as MQTT.
GNU General Public License v2.0
29 stars 8 forks source link

Logging to STDOUT/STDERR in addition to /var/logs/smahub #7

Closed derTim closed 1 year ago

derTim commented 1 year ago

I just set up (as a stack in portainer) smahub with the docker-compose config supplied in the README, and at first I thought, that it is not working at all, because the log output was not showing anything. docker logs [containerId] on the host was also empty.

After checking the run_smahub.sh I realized, that there is some log output to /var/logs/smahub, and after checking my mqtt broker, I saw that smahub is working fine.

Adding STDOUT/SDTERR in addition would help anybody who is running smahub in a dockerized setup to see what's going on.

AnotherDaniel commented 1 year ago

Good point, and thank you for bringing this up!

I made a change to the startup script, please check out v1.2.4 and let me know if that behaves as it should!

devfaz commented 1 year ago

I'm using the image within k8s, because of this redirect to the logfile I overwrite the entrypoint/command in the pod spec.

I personally don't get why someone wants an unmanaged file laying within the container and growing indefinitely?

Why not simply write to stdout/stderr?

AnotherDaniel commented 1 year ago

Should have done that with the tee command - but I get your point, I removed the output redirects entirely with 1.2.5

derTim commented 1 year ago

I just redployed the stack, log output is now visible in portainer, and also with docker logs

tim@srvearth-docker:~/docker-images/smahub$ docker logs f84ea2fd4070 2023-08-03 19:39:34 INFO Starting SHM2 source 2023-08-03 19:39:34 INFO Starting Tripower X source 2023-08-03 19:39:34 INFO demo source plugin disabled 2023-08-03 19:39:34 INFO Starting MQTT sink 2023-08-03 19:39:34 INFO HA-MQTT sink plugin disabled 2023-08-03 19:39:34 INFO Starting gen_ha_sensors sink 2023-08-03 19:39:34 INFO demo sink plugin disabled

Thanks for the quick fix!