问题原文
原帖链接 · kolypto · CC BY-SA 3.0
I'm deploying a 3rd-party application in compliance with the 12 factor advisory, and one of the points tell that application logs should be printed to stdout/stderr: then clustering software can collect it.
However, the application can only write to files or syslog. How do I print these logs instead?
已采纳解答
原帖链接 · kolypto · CC BY-SA 3.0
An amazing recipe is given in the nginx Dockerfile:
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
Simply, the app can continue writing to it as a file, but as a result the lines will go to stdout & stderr!
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
