Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ dependencies {
implementation 'me.paulschwarz:spring-dotenv:4.0.0'
implementation 'org.springframework.security:spring-security-crypto'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
Expand Down
16 changes: 11 additions & 5 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spring:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQL8Dialect

config:
activate:
on-profile: dev
Expand All @@ -21,12 +22,17 @@ server:
port: 9000

logging:
level:
org.springframework.security: DEBUG
org.hibernate.SQL: DEBUG
org.hibernate.type.descriptor.sql.BasicBinder: TRACE
config: classpath:logback-dev.xml

auth:
jwt:
private-key-path: ${JWT_PRIVATE_KEY_PATH}
public-key-path: ${JWT_PUBLIC_KEY_PATH}
public-key-path: ${JWT_PUBLIC_KEY_PATH}

management:
tracing:
sampling:
probability: 1.0
zipkin:
tracing:
endpoint: ${ZIPKIN_URL}/api/v2/spans

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

파일의 마지막에 개행 문자를 추가하는 것을 권장합니다. 이는 텍스트 파일에 대한 POSIX 표준이며, Git과 같은 버전 관리 시스템이나 다른 텍스트 처리 도구와의 호환성을 높여줍니다.

      endpoint: ${ZIPKIN_URL}/api/v2/spans

36 changes: 36 additions & 0 deletions src/main/resources/logback-dev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<configuration>
<property name="LOG_PATTERN"
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - [traceId=%X{traceId}, spanId=%X{spanId}] %msg%n"/>
<property name="ACTIVE_LOG" value="/logs/application.log"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

로그 파일 경로에 절대 경로('/logs/application.log')를 사용하면 권한 문제나 이식성 문제가 발생할 수 있습니다. 애플리케이션 실행 위치 기준으로 로그 파일이 생성되도록 상대 경로('logs/application.log')를 사용하는 것이 좋습니다.

또한, 현재 설정에서는 활성 로그 파일(<file>)은 절대 경로 /logs에 저장되지만, 롤링된 아카이브 파일(<fileNamePattern>)은 상대 경로 logs에 저장되어 경로가 일치하지 않는 문제가 발생합니다. 상대 경로로 통일하여 일관성을 유지하고 예기치 않은 동작을 방지하는 것이 좋습니다.

Suggested change
<property name="ACTIVE_LOG" value="/logs/application.log"/>
<property name="ACTIVE_LOG" value="logs/application.log"/>


<!-- 콘솔 출력 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>

<!-- 파일 출력 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${ACTIVE_LOG}</file>
<append>true</append>
<!-- 날짜+용량 기준 롤링 권장 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 아카이브 파일 경로 -->
<fileNamePattern>logs/application.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>100MB</maxFileSize>
<!-- 총 보관 용량 한도 -->
<totalSizeCap>512MB</totalSizeCap>
<!-- 보관 일수 -->
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</configuration>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

파일 끝에 개행 문자를 추가하는 것이 좋습니다. 이는 POSIX 표준을 따르는 좋은 관행이며, 일부 도구에서 파일을 처리할 때 예기치 않은 문제를 방지할 수 있습니다.

Suggested change
</configuration>
</configuration>