vSince changes in a running container will get wiped out after a container stops, it’s typically a good idea to configure any Dockerized service to log to stdout and then configure the Docker daemon however you see fit to store your logs. This is recommended by Docker and it’s considered a best practice.

There’s many other advantages that aren’t specific to Docker for logging to stdout instead of a specific log file too, such as being able to collect and query them on 1 server with journald / journalctl or ship them to a centralized logging server / service.

You also only need to worry about rotating your journald logs instead of every service’s individual log files. You can also easily archive and export your logs to standard formats such as json if you go the stdout -> syslog -> journald route.

In this video we’ll cover a few reasons and wrap things up by seeing how to configure a few different web app servers to log to stdout.

#docker #elixir #flask #ruby-on-rails

Why Your Web Server Should Log to Stdout (Especially with Docker)
1.50 GEEK