Skip to content

Commit

Permalink
Merge pull request #142 from YAPP-19th/feature/#140-리팩터링
Browse files Browse the repository at this point in the history
[#140] logback 설정
  • Loading branch information
Ji-Ha authored Jun 20, 2022
2 parents aceeb61 + 4054020 commit f20858c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
with:
host: ${{ secrets.HOST_PROD }}
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }}
#key: ${{ secrets.PRIVATE_KEY }}
envs: GITHUB_SHA
script: |
sudo docker pull ${{ secrets.DOCKER_REPO }}/dotoriham-prod
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.yapp.web2.exception.custom

import com.yapp.web2.exception.BusinessException
import com.yapp.web2.util.Message

open class ObjectNotFoundException : BusinessException(Message.OBJECT_NOT_FOUND)
37 changes: 32 additions & 5 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<configuration>
<!-- 변수 설정 -->
<property name="LOG_DIR" value="/home/ec2-user/logs"/>
<property name="LOG_FILE" value="${LOG_DIR}/logfile.log"/>
<property name="LOG_DIR_SERVER" value="/home/ec2-user/logs"/>
<property name="LOG_FILE" value="logfile.log"/>

<property name="LOG_FILE_PROD" value="${LOG_DIR_SERVER}/${LOG_FILE}"/>
<property name="LOG_FILE_DEV" value="${LOG_DIR_SERVER}/${LOG_FILE}"/>
<property name="LOG_FILE_LOCAL" value="./log/${LOG_FILE}"/>

<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
Expand All @@ -11,12 +16,34 @@
</appender>

<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>./log/debug.log</file>
<springProfile name="prod">
<file>${LOG_FILE_PROD}</file>
</springProfile>

<springProfile name="dev">
<file>${LOG_FILE_DEV}</file>
</springProfile>

<springProfile name="local">
<file>${LOG_FILE_LOCAL}</file>
</springProfile>

<!-- 사이즈 & 일자별로 로그 파일 적용 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>/home/ec2-user/logs/%d{yyyy-MM}/log.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<springProfile name="prod">
<fileNamePattern>${LOG_DIR_SERVER}/%d{yyyy-MM}/log.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
</springProfile>

<springProfile name="dev">
<fileNamePattern>${LOG_DIR_SERVER}/%d{yyyy-MM}/log.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
</springProfile>

<springProfile name="local">
<fileNamePattern>./log/%d{yyyy-MM}/log.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
</springProfile>

<maxFileSize>10MB</maxFileSize>
<maxHistory>90</maxHistory>
<maxHistory>180</maxHistory>
</rollingPolicy>
<encoder>
<Pattern>[%d{yyyy-MM-dd HH:mm:ss}][%thread] %-5level %logger{36} - %msg%n</Pattern>
Expand Down

0 comments on commit f20858c

Please sign in to comment.