You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/04/01 01:11:38 UTC

[apisix-docker] branch master updated: feat: support printing logs via stdout and stderr when using docker (#156)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f7673d  feat: support printing logs via stdout and stderr when using docker (#156)
3f7673d is described below

commit 3f7673d4da756bc6511b9b0ffcf23f8af65870b1
Author: wonglend <gk...@qq.com>
AuthorDate: Thu Apr 1 09:11:29 2021 +0800

    feat: support printing logs via stdout and stderr when using docker (#156)
---
 alpine/Dockerfile | 4 ++++
 centos/Dockerfile | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/alpine/Dockerfile b/alpine/Dockerfile
index 5ff4e86..7e5496f 100644
--- a/alpine/Dockerfile
+++ b/alpine/Dockerfile
@@ -38,6 +38,10 @@ COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/
 COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/
 COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix
 
+# forward request and error logs to docker log collector
+RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
+    && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
+
 ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
 
 EXPOSE 9080 9443
diff --git a/centos/Dockerfile b/centos/Dockerfile
index dbf557a..ddb06dd 100644
--- a/centos/Dockerfile
+++ b/centos/Dockerfile
@@ -12,6 +12,10 @@ RUN yum -y install yum-utils\
 
 WORKDIR /usr/local/apisix
 
+# forward request and error logs to docker log collector
+RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
+    && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
+
 EXPOSE 9080 9443
 
 CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"]