From dc3c400cce55408ebda3fc73e736820ee2effaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9A=B0=ED=98=81=EC=A4=80=20=28HyukJoon=20Woo=29?= Date: Thu, 11 Apr 2024 22:46:09 +0900 Subject: [PATCH] =?UTF-8?q?Config:=20=EB=A1=9C=EA=B7=B8=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=A0=80=EC=9E=A5=20=EC=B6=94=EA=B0=80,=20?= =?UTF-8?q?=ED=95=AD=EB=AA=A9=20=EC=B6=94=EA=B0=80=20(#266)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Config: Add async file log appender for dev, prod env * Config: Set log to show servlet, security, sql info for all profile. * CICD: Mount log directory. * Fix: Fix property * Fix: Extract and set log file name and base property for all profiles. --- docker-compose-backend.yml | 1 + src/main/resources/application.yaml | 44 ++++++++++++++++----------- src/main/resources/logback-spring.xml | 29 ++++++++++++++++-- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/docker-compose-backend.yml b/docker-compose-backend.yml index f8469c0d..287f0108 100644 --- a/docker-compose-backend.yml +++ b/docker-compose-backend.yml @@ -6,6 +6,7 @@ services: volumes: - ./cse-files:/app/cse-files - ./files:/app/files + - ./logs:/app/logs environment: SPRING_DATASOURCE_URL: "jdbc:mysql://host.docker.internal:3306/${MYSQL_DATABASE}?serverTimezone=Asia/Seoul&useSSL=false&allowPublicKeyRetrieval=true" diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 46f814e8..835e2c45 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -9,6 +9,7 @@ spring: hikari: maximum-pool-size: 65 jpa: + show-sql: true properties: hibernate: dialect: com.wafflestudio.csereal.common.config.MySQLDialectCustom @@ -47,6 +48,19 @@ endpoint: login-page: http://localhost:8080 + +logging: + level: + org: + springframework: + security: DEBUG + web: + servlet: DEBUG + +customlog: + file: + name: "csereal-backend" + --- spring: config.activate.on-profile: local @@ -57,7 +71,6 @@ spring: jpa: hibernate: ddl-auto: update - show-sql: true open-in-view: false security: oauth2: @@ -74,12 +87,9 @@ spring: issuer-uri: https://id.snucse.org/o jwk-set-uri: https://id.snucse.org/o/jwks -logging: - level: - # default: INFO - org: - springframework: - security: DEBUG +customlog: + file: + base: "./logs" --- spring: @@ -120,13 +130,16 @@ slack: token: ${SLACK_TOKEN} channel: ${SLACK_CHANNEL} +customlog: + file: + base: "/app/logs" + --- spring: config.activate.on-profile: dev jpa: hibernate: ddl-auto: update - show-sql: true open-in-view: false security: oauth2: @@ -156,6 +169,9 @@ endpoint: login-page: https://${URL} +customlog: + file: + base: "./logs" --- spring: config.activate.on-profile: test @@ -167,7 +183,6 @@ spring: jpa: database: h2 database-platform: org.hibernate.dialect.H2Dialect - show-sql: true open-in-view: false hibernate: ddl-auto: create-drop @@ -177,11 +192,6 @@ spring: h2: console: enabled: true - -logging: - level: - # default: INFO - org: - springframework: - security: DEBUG - +customlog: + file: + base: "./logs" diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index d7d3352b..cb4d3e48 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -11,11 +11,10 @@ + - - @@ -36,6 +35,30 @@ + + + + + + ${LOG_FILE_BASE}/${LOG_FILE_NAME}.log + + ${FILE_LOG_PATTERN} + ${FILE_LOG_CHARSET} + + + ${LOG_FILE_BASE}/${LOG_FILE_NAME}_%d{yyyy-MM-dd}.log + false + 30 + + + + + + 5000 + + + + @@ -45,6 +68,7 @@ + @@ -52,6 +76,7 @@ +