From 6f1b69adf0578df255030f590bc77022365e72ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9E=AC=EC=9B=90?= Date: Thu, 24 Oct 2024 15:53:57 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EB=A1=9C=EA=B7=B8=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=A0=80=EC=9E=A5=20=EC=84=A4=EC=A0=95=EC=9A=A9=20logback-s?= =?UTF-8?q?pring.yml=20=EC=B6=94=EA=B0=80=20(#273)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++ build.gradle.kts | 2 + gradle/libs.versions.toml | 8 ++++ src/main/resources/logback-spring.xml | 45 +++++++++++++++++++ .../resources/logback-variables.properties | 3 ++ 5 files changed, 62 insertions(+) create mode 100644 src/main/resources/logback-spring.xml create mode 100644 src/main/resources/logback-variables.properties diff --git a/.gitignore b/.gitignore index 3abe6631..8aaf6f38 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ out/ ### etc ### .DS_Store +### Project ### **/main/generated/ **/resources/.env @@ -46,3 +47,6 @@ out/ !**/resources/.env.example **/resources/app/apple/*.p8 + +### Logs ### +logs/** diff --git a/build.gradle.kts b/build.gradle.kts index 224348b6..9cba3986 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,6 +65,8 @@ dependencies { implementation(libs.resilience4j.spring.boot) + implementation(libs.bundles.logback) + runtimeOnly(libs.micrometer.registry.prometheus) testImplementation(libs.bundles.spring.boot.test) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index efc6f53f..f32987a6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -48,6 +48,9 @@ caffeine = { group = "com.github.ben-manes.caffeine", name = "caffeine", version micrometer-registry-prometheus = { group = "io.micrometer", name = "micrometer-registry-prometheus", version = "1.13.4" } resilience4j-spring-boot = { group = "io.github.resilience4j", name = "resilience4j-spring-boot3", version = "2.2.0" } +logback-json-classic = { group = "ch.qos.logback.contrib", name = "logback-json-classic", version = "0.1.5" } +logback-jackson = { group = "ch.qos.logback.contrib", name = "logback-jackson", version = "0.1.5" } + [bundles] spring-boot = [ "spring-boot-starter", @@ -79,6 +82,11 @@ jooq = [ "jooq-meta", ] +logback = [ + "logback-json-classic", + "logback-jackson", +] + [plugins] spring-boot = { id = "org.springframework.boot", version.ref = "spring-boot" } spring-dependency-management = { id = "io.spring.dependency-management", version.ref = "dependency-management" } diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..6f262243 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + %clr(%d{${LOG_DATEFORMAT_PATTERN}}){magenta} %clr([%thread]){blue} %clr(%-5level){} %clr([%logger{0}:%line]){cyan} : %msg %n + + + + + + + + ${LOG_DATEFORMAT_PATTERN} + + Asia/Seoul + true + + + false + + + + + ${LOG_PATH}/${ToMonth}/${ToDay}_${LOG_FILE_NAME}.log + + + ${LOG_PATH}/%d{yyyy-MM}/%d{yyyy-MM-dd}_${LOG_FILE_NAME}_%i.log + + 10MB + 30 + + + + + + + + + diff --git a/src/main/resources/logback-variables.properties b/src/main/resources/logback-variables.properties new file mode 100644 index 00000000..5e0ef362 --- /dev/null +++ b/src/main/resources/logback-variables.properties @@ -0,0 +1,3 @@ +LOG_PATH = logs +LOG_FILE_NAME = runus +LOG_DATEFORMAT_PATTERN = yyyy-MM-dd HH:mm:ss.SSSX