-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] Prod 환경 로그 설정 #201
[FEAT] Prod 환경 로그 설정 #201
Changes from all commits
6ed4133
98b57b5
d8695d0
f078f13
ba8cc07
f013da8
857be8c
1599526
ae5cd68
a91827a
7f93537
d76c90f
5721b9c
23aba5d
101ca89
9739fb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<!-- ddangkong 패키지에 대한 로그를 파일에 출력하기 위한 설정 --> | ||
<springProperty name="LOG_HOME_PATH" source="logging.location"/> | ||
<property name="LOG_PATH" value="${LOG_HOME_PATH}/app-logs"/> | ||
<appender name="DDANGKONG_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_PATH}/ddangkong.log</file> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_PATH}/ddangkong-%d{yyyy-MM-dd}.log</fileNamePattern> <!-- 매일 새로운 파일 생성 --> | ||
<maxHistory>365</maxHistory> | ||
</rollingPolicy> | ||
<encoder> | ||
<pattern>%d{yyyy-MM-dd HH:mm:ss,Asia/Seoul} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<!-- Discord Webhook 설정 --> | ||
<springProperty name="DISCORD_WEBHOOK_URL" source="logging.discord.webhook-url"/> | ||
<appender name="DISCORD" class="com.github.napstr.logback.DiscordAppender"> | ||
<webhookUri>${DISCORD_WEBHOOK_URL}</webhookUri> | ||
<layout class="ch.qos.logback.classic.PatternLayout"> | ||
<pattern>%d{yyyy-MM-dd HH:mm:ss,Asia/Seoul} [%thread] [%-5level] %logger{36} - %msg%n```%ex{full}``` | ||
</pattern> | ||
</layout> | ||
<username>prod-error-alert-bot</username> | ||
<avatarUrl> | ||
https://velog.velcdn.com/images/gwichanlee/post/c03a74cc-07fd-45ee-bfff-7b5147522f89/image.png | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 질문) 요 사진은 정말 그대로 가시나요 ㅋㅋㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 뭐 개발 환경에서도 잘 사용하는데요 ㅋㅋ 해당 정보는 사용자한테 노출 안되는 정보라 크게 상관 없을 것 같아요~ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 전 좋아요 ㅋㅋㅋㅋㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 노출되면 인플루언서로 전직하죠 |
||
</avatarUrl> | ||
<tts>false</tts> | ||
</appender> | ||
|
||
<appender name="ASYNC_DISCORD" class="ch.qos.logback.classic.AsyncAppender"> | ||
<appender-ref ref="DISCORD"/> | ||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
<level>ERROR</level> | ||
</filter> | ||
</appender> | ||
|
||
<!-- ddangkong 하위 패키지의 logger 설정 --> | ||
<logger name="ddangkong" level="INFO" additivity="false"> | ||
<appender-ref ref="DDANGKONG_LOG"/> | ||
<appender-ref ref="ASYNC_DISCORD"/> | ||
</logger> | ||
|
||
<!-- root logger 설정 --> | ||
<root level="OFF"> | ||
</root> | ||
</configuration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
질문)
1년인 이유가 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일단 운영 환경의 로그는 (개발 환경 보다는) 길게 해야 한다고 생각합니다. 그래서 사용자의 불편함 등을 더 많은 정보로 트래킹 할 수 있기 때문이죠.
그렇다고 딱 1년인 이유는 없습니다. 더 길면 길수록 좋다고 생각하는데, 하드 용량을 생각해서 대충 1년 설정했습니다. 트래킹 하면서 조정해봐야 될 것 같습니다.