diff --git a/.github/workflows/be-cd-prod.yml b/.github/workflows/be-cd-prod.yml index 8496ec2d7..fb59e74f1 100644 --- a/.github/workflows/be-cd-prod.yml +++ b/.github/workflows/be-cd-prod.yml @@ -38,7 +38,7 @@ jobs: run: ./gradlew bootJar - name: Stop existing Java Application - run: ps -ef | grep 'ddangkong-0.0.1-SNAPSHOT.jar' | awk '{print $2}' | xargs sudo kill -15 + run: ps -ef | grep 'java -jar' | awk '{print $2}' | xargs sudo kill -15 || true - name: Start Java Application - run: sudo nohup java -jar ddangkong-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod & + run: sudo nohup java -jar -Dspring.profiles.active=prod ./build/libs/ddangkong-0.0.1-SNAPSHOT.jar & diff --git a/backend/src/main/resources/application-prod.yml b/backend/src/main/resources/application-prod.yml index 0289b6909..37beb7652 100644 --- a/backend/src/main/resources/application-prod.yml +++ b/backend/src/main/resources/application-prod.yml @@ -26,3 +26,8 @@ server: cors: origin: ${secret.cors.origin} +logging: + config: classpath:logback-prod.xml + discord: + webhook-url: ${secret.discord.webhook-url} + location: ${secret.application.log.location} diff --git a/backend/src/main/resources/logback-prod.xml b/backend/src/main/resources/logback-prod.xml new file mode 100644 index 000000000..4ed111f6b --- /dev/null +++ b/backend/src/main/resources/logback-prod.xml @@ -0,0 +1,48 @@ + + + + + + + ${LOG_PATH}/ddangkong.log + + ${LOG_PATH}/ddangkong-%d{yyyy-MM-dd}.log + 365 + + + %d{yyyy-MM-dd HH:mm:ss,Asia/Seoul} [%thread] %-5level %logger{36} - %msg%n + + + + + + + ${DISCORD_WEBHOOK_URL} + + %d{yyyy-MM-dd HH:mm:ss,Asia/Seoul} [%thread] [%-5level] %logger{36} - %msg%n```%ex{full}``` + + + prod-error-alert-bot + + https://velog.velcdn.com/images/gwichanlee/post/c03a74cc-07fd-45ee-bfff-7b5147522f89/image.png + + false + + + + + + ERROR + + + + + + + + + + + + +