diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 364822c..784aa3b 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -32,6 +32,11 @@ jobs: /secret/lequu parse-json: false + - name: application-secret.properties 생성 (환경변수가 AWS Secrets Manager보다 빠르게 로드되어야 할때) + run: | + cd src/main/resources + echo "${{ secrets.PROPERTIES }}" > ./application-secret.properties + - name: Build run: | chmod +x gradlew diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9abc1a5..2dfeae0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,6 +34,11 @@ jobs: /secret/lequu parse-json: false + - name: application-secret.properties 생성 (환경변수가 AWS Secrets Manager보다 빠르게 로드되어야 할때) + run: | + cd src/main/resources + echo "${{ secrets.PROPERTIES }}" > ./application-secret.properties + - name: Build run: | chmod +x gradlew diff --git a/src/main/java/org/sopt/lequuServer/global/common/logging/LoggingMessage.java b/src/main/java/org/sopt/lequuServer/global/common/logging/LoggingMessage.java index 26371a5..40fe3f7 100644 --- a/src/main/java/org/sopt/lequuServer/global/common/logging/LoggingMessage.java +++ b/src/main/java/org/sopt/lequuServer/global/common/logging/LoggingMessage.java @@ -4,6 +4,9 @@ import org.sopt.lequuServer.domain.member.model.Member; import org.sopt.lequuServer.domain.note.model.Note; +import java.text.SimpleDateFormat; +import java.util.Date; + public class LoggingMessage { public static String memberRegisterLogMessage(Member member) { @@ -41,12 +44,18 @@ public static String noteCreateLogMessage(Member member, Book book, Note note) { } public static String serverErrorMessage() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String formattedDate = sdf.format(new Date()); return "🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨\n\n" + + "- ⚠️ ERROR TIME: " + formattedDate + "\n" + "- 🚨 야생의 서버 에러가 발생했다!: "; } public static String jwtErrorMessage() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String formattedDate = sdf.format(new Date()); return "🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨\n\n" + + "- ⚠️ ERROR TIME: " + formattedDate + "\n" + "- 🚨 JWT 에러 필터에서 오류 발생!: "; } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 2bd8431..df6666f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -2,6 +2,7 @@ spring: config: activate: on-profile: dev + import: optional:application-secret.properties datasource: driver-class-name: ${DB_NAME_DEV} @@ -36,4 +37,12 @@ server: sentry: dsn: ${SENTRY_DSN} traces-sample-rate: 1.0 - exception-resolver-order: -2147483647 \ No newline at end of file + exception-resolver-order: -2147483647 + +logging: + discord: + error-uri: ${DISCORD_ERROR_URI} + business-1-uri: ${DISCORD_BUSINESS_1_URI} + business-2-uri: ${DISCORD_BUSINESS_2_URI} + business-3-uri: ${DISCORD_BUSINESS_3_URI} + config: classpath:logback-dev.xml \ No newline at end of file diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index a7f91f0..410edd4 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -34,4 +34,7 @@ kakao: sentry: dsn: traces-sample-rate: 1.0 - exception-resolver-order: -2147483647 \ No newline at end of file + exception-resolver-order: -2147483647 + +logging: + config: classpath:logback-local.xml \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2ccd6d6..344132b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -32,7 +32,4 @@ springdoc: enabled: true cache: disabled: true - show-login-endpoint: true - -logging: - config: classpath:logback-spring.xml \ No newline at end of file + show-login-endpoint: true \ No newline at end of file diff --git a/src/main/resources/discord-business-appender.xml b/src/main/resources/discord-business-appender.xml index 7f2c5cb..1fd7283 100644 --- a/src/main/resources/discord-business-appender.xml +++ b/src/main/resources/discord-business-appender.xml @@ -1,7 +1,7 @@ - https://discord.com/api/webhooks/1195948437414359130/XUALknmWMWxKINukDY-7vakMQ6azarz7eGZV_NXb2c9v3a3ohjr8InY5Obi5wMocanDy + ${DISCORD_BUSINESS_1_URI} Register is detected 🐣 https://github.com/Team-Lecue/Lecue-Server/assets/67463603/67cf5665-ab6c-4eb0-8fa2-85a6dd8188b6 @@ -19,7 +19,7 @@ - https://discord.com/api/webhooks/1195949062709575810/dF7Oxhpf7tc1p_ypzGQv2FU4g8Fe2u_hC49_yqXsbRjJisOwK5m-c92T7VEQn8Ish-GV + ${DISCORD_BUSINESS_2_URI} Lecue Book is created 📝 https://github.com/Team-Lecue/Lecue-Server/assets/67463603/76b91fd6-3589-4c74-9b70-2b6e251ac384 @@ -37,7 +37,7 @@ - https://discord.com/api/webhooks/1195948338546221107/7eaJ2jjDrMeOg-OO9lZfX2SjCTmHbDQom7wD04ffpMXyJBFx6sJDGetmDlQlXcAQDEHO + ${DISCORD_BUSINESS_3_URI} Lecue Note is attached 💌 https://github.com/Team-Lecue/Lecue-Server/assets/67463603/25641e5f-9e28-4852-9458-380313c953cc diff --git a/src/main/resources/discord-error-appender.xml b/src/main/resources/discord-error-appender.xml index b21fb38..26b7404 100644 --- a/src/main/resources/discord-error-appender.xml +++ b/src/main/resources/discord-error-appender.xml @@ -1,7 +1,7 @@ - https://discord.com/api/webhooks/1195711881223090307/PlB-JBGazAPBK5-KzMWs4Ei6DEy9Evd4IsFIxylgHXZuV-iNvsrs2ejzA2b3QJLVlrpy + ${DISCORD_ERROR_URI} Internel Server Error detected 🚨 https://s3.orbi.kr/data/file/united/251cc0d1434cc0aed00afe93082bb25a.jpeg diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-dev.xml similarity index 75% rename from src/main/resources/logback-spring.xml rename to src/main/resources/logback-dev.xml index 689503e..4e6f3af 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-dev.xml @@ -2,15 +2,10 @@ - - - - - - - - + + + + diff --git a/src/main/resources/logback-local.xml b/src/main/resources/logback-local.xml new file mode 100644 index 0000000..b571506 --- /dev/null +++ b/src/main/resources/logback-local.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file