wk275 / qbTools-v2

Tooling environment for Qbus and MQTT via Nodered.
GNU General Public License v3.0
2 stars 0 forks source link

Logfile QBUSMQTTGW is not persistent after a container restart. #4

Closed asulonn closed 1 year ago

asulonn commented 1 year ago

It's more a suggestion than a issue.

In my setup i removed the last part of the Dockerfile command. From: CMD /usr/bin/qbus/./qbusMqttGw -serial="QBUSMQTTGW" -logbuflevel -1 -logtostderr true -storagedir /opt/qbus -mqttbroker "tcp://127.0.0.1:11883" -mqttuser qb-mos -mqttpassword qbmos@10 > /log/qbusmqtt.log 2>&1

To: CMD /usr/bin/qbus/./qbusMqttGw -serial="QBUSMQTTGW" -logbuflevel -1 -logtostderr true -storagedir /opt/qbus -mqttbroker "tcp://127.0.0.1:11883" -mqttuser qb-mos -mqttpassword qbmos@10

Because of an error, my container was restarting constantly. The log file seems to be refreshed (wiped) each time the container is restarted. Because of that, the error that actually made the container restart, was never showing in the logs. After I removed the log file specification, I could watch the log data in the log output (i used Portainer, it has a nice UI for managing the containers, including watching the log output). This logfile data is persistent after a container restart. It mad me see what the error was that was stopping the container.

This helped me out, meaby other two... Or is there a way to make the logfile persistent after a restart? I could not immediately find it.

wk275 commented 1 year ago

If you want to append to the log file use following command. CMD /usr/bin/qbus/./qbusMqttGw -serial="QBUSMQTTGW" -logbuflevel -1 -logtostderr true -storagedir /opt/qbus -mqttbroker "tcp://127.0.0.1:11883" -mqttuser qb-mos -mqttpassword qbmos@10 >> /log/qbusmqtt.log 2>&1