Closed li-thy-um closed 6 years ago
This is a common docker use question. https://github.com/moby/moby/issues/1385 https://github.com/moby/moby/issues/18327
https://github.com/docker/compose/issues/1549
You may fix it through https://stackoverflow.com/questions/36417888/log-issue-in-rails4-with-docker-running-rake-task
It's also recommended to use log file instead of STDOUT in docker.
Midori::Configure.log = Logger.new("file location")
@dsh0416 but why it will puts logs sync with midori.rb v0.5.0?
@li-thy-um Nope, STDOUT behaves asynchronously by default. But ruby could not detect the tty buffer size inside docker, so it may not work properly. You may need to set the log to sync which would force ruby to flush every time it have something to print.
Using
master
branch Deploy on Aliyun swarm mode cluster with two containers on two different machines. When I stop the container, it will output all the missing logs.Empty output when container is alive.
When I stop the container, it will puts all logs at once.
My Dockerfile looks like this:
NOTE: I double checked, logging is improper on both containers.