-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from Korea-Certified-Store/develop
Develop to Main 릴리즈 (#87)
- Loading branch information
Showing
14 changed files
with
272 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,5 @@ out/ | |
env.yml | ||
|
||
### 로그 파일 ### | ||
/src/main/resources/logs/ | ||
/src/main/resources/logs/ | ||
/logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -491,3 +491,4 @@ public List<StoreRegularOpeningHours> parseWeekdayDescriptions(List<String> week | |
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/nainga/nainga/global/aspect/LogAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.nainga.nainga.global.aspect; | ||
|
||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.aspectj.lang.JoinPoint; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.AfterThrowing; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.aspectj.lang.annotation.Pointcut; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Aspect | ||
@Order(1) | ||
@Component | ||
public class LogAspect { | ||
|
||
@Pointcut("bean(*Service)") | ||
private void allService() { | ||
} | ||
|
||
@Pointcut("bean(*Api)") | ||
private void allRequest() { | ||
} | ||
|
||
@AfterThrowing(pointcut = "allService()", throwing = "ex") | ||
private void logException(JoinPoint joinPoint, RuntimeException ex) { | ||
String Name = ex.getClass().getSimpleName(); | ||
String Message = ex.getMessage(); | ||
String methodName = joinPoint.getSignature().toShortString(); | ||
Object[] args = joinPoint.getArgs(); | ||
log.warn("[Exception] {} Name=[{}] Message=[{}] args=[{}]", | ||
methodName, Name, Message, args); | ||
} | ||
|
||
@Around("allRequest()") | ||
private Object logRequest(ProceedingJoinPoint joinPoint) throws Throwable { | ||
long beforeRequest = System.currentTimeMillis(); | ||
String methodName = joinPoint.getSignature().toShortString(); | ||
Object result = joinPoint.proceed(); | ||
long timeTaken = System.currentTimeMillis() - beforeRequest; | ||
log.debug("[Request] {} time=[{}ms]", methodName, timeTaken); | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<configuration> | ||
|
||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/> | ||
|
||
<property name="CUSTOM_CONSOLE_LOG_PATTERN" value="[%X{request_id:-nainga}] ${CONSOLE_LOG_PATTERN}"/> | ||
<property name="CUSTOM_FILE_LOG_PATTERN" value="[%X{request_id:-nainga}] ${FILE_LOG_PATTERN}"/> | ||
|
||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>${CUSTOM_CONSOLE_LOG_PATTERN}</pattern> | ||
<charset>utf8</charset> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="FILE-DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<encoder> | ||
<pattern>${CUSTOM_FILE_LOG_PATTERN}</pattern> | ||
</encoder> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>DEBUG</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>logs/debug/debug-%d{yyyy-MM-dd}.log</fileNamePattern> | ||
<maxHistory>30</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="FILE-INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<encoder> | ||
<pattern>${CUSTOM_FILE_LOG_PATTERN}</pattern> | ||
</encoder> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>INFO</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>logs/info/info-%d{yyyy-MM-dd}.log</fileNamePattern> | ||
<maxHistory>30</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="FILE-WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<encoder> | ||
<pattern>${CUSTOM_FILE_LOG_PATTERN}</pattern> | ||
</encoder> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>WARN</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>logs/warn/warn-%d{yyyy-MM-dd}.log</fileNamePattern> | ||
<maxHistory>30</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="FILE-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<encoder> | ||
<pattern>${CUSTOM_FILE_LOG_PATTERN}</pattern> | ||
</encoder> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>ERROR</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>logs/error/error-%d{yyyy-MM-dd}.log</fileNamePattern> | ||
<maxHistory>30</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<logger name="com.nainga.nainga" level="DEBUG" /> | ||
<root level="info"> | ||
<appender-ref ref="CONSOLE"/> | ||
<appender-ref ref="FILE-DEBUG"/> | ||
<appender-ref ref="FILE-INFO"/> | ||
<appender-ref ref="FILE-WARN"/> | ||
<appender-ref ref="FILE-ERROR"/> | ||
</root> | ||
</configuration> |
Oops, something went wrong.