diff --git a/Dockerfile b/Dockerfile index 1df9e03..c17d0ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,6 +77,7 @@ COPY --from=stage-chen-build /opt/chen/backend/web/target/web-*.jar /opt/chen/ch COPY --from=stage-chen-build /opt/chen/entrypoint.sh . COPY --from=stage-chen-build /opt/chen/drivers /opt/chen/drivers COPY --from=stage-chen-build /opt/chen/config/application.yml /opt/chen/config/application.yml +COPY --from=stage-chen-build /opt/chen/config/logback.xml /opt/chen/config/logback.xml ARG VERSION ENV VERSION=$VERSION diff --git a/config/application.yml b/config/application.yml index b3d8688..3553c81 100644 --- a/config/application.yml +++ b/config/application.yml @@ -8,10 +8,7 @@ server: enabled: true logging: - level: - root: INFO - file: - name: data/logs/chen.log + config: config/logback.xml spring: messages: diff --git a/config/logback.xml b/config/logback.xml new file mode 100644 index 0000000..7afaa6d --- /dev/null +++ b/config/logback.xml @@ -0,0 +1,27 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss,Asia/Shanghai} [%thread] %-5level %logger - %msg%n + + + + data/logs/chen.log + + data/logs/chen.log.%d{yyyy-MM-dd}.%i.gz + 10MB + GZ + + + %d{yyyy-MM-dd HH:mm:ss,Asia/Shanghai} [%thread] %-5level %logger - %msg%n + + + + + + + + + + \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index ec7d8c2..7b3926c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,7 +16,7 @@ if [ ! "$LOG_LEVEL" ]; then LOG_LEVEL=ERROR fi -sed -i "s@root: INFO@root: ${LOG_LEVEL}@g" /opt/chen/config/application.yml +sed -i "s@level=\"INFO\"@level=\"${LOG_LEVEL}\"@g" /opt/chen/config/logback.xml echo date