-
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.
- Loading branch information
1 parent
da2d5a0
commit 656255b
Showing
5 changed files
with
148 additions
and
1 deletion.
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
21 changes: 21 additions & 0 deletions
21
src/main/java/kr/co/studyhubinu/studyhubserver/TestController.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,21 @@ | ||
package kr.co.studyhubinu.studyhubserver; | ||
|
||
import io.sentry.Sentry; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class TestController { | ||
|
||
@GetMapping("/v1/asd/12") | ||
public ResponseEntity<HttpStatus> test() { | ||
try { | ||
throw new Exception("This is a test."); | ||
} catch (Exception e) { | ||
Sentry.captureException(e); | ||
} | ||
return ResponseEntity.ok().build(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
|
||
<property name="LOGS_ABSOLUTE_PATH" value="./logs"/> | ||
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %highlight(%-5level) %logger{36} - %msg%n"/> | ||
|
||
<property name="MAX_HISTORY" value="30"/> | ||
<property name="PERFORMANCE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss} %-5level %msg%n"/> | ||
|
||
<!-- Console Appender --> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<layout class="ch.qos.logback.classic.PatternLayout"> | ||
<Pattern>${LOG_PATTERN}</Pattern> | ||
</layout> | ||
</appender> | ||
|
||
<appender name="INFO_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
|
||
<file>${LOGS_ABSOLUTE_PATH}/info.log</file> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>INFO</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
<encoder> | ||
<Pattern>${LOG_PATTERN}</Pattern> | ||
</encoder> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOGS_ABSOLUTE_PATH}/info.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> | ||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
<maxFileSize>100MB</maxFileSize> | ||
</timeBasedFileNamingAndTriggeringPolicy> | ||
<maxHistory>${MAX_HISTORY}</maxHistory> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="WARN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
|
||
<file>${LOGS_ABSOLUTE_PATH}/warn.log</file> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>WARN</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
<encoder> | ||
<Pattern>${LOG_PATTERN}</Pattern> | ||
</encoder> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOGS_ABSOLUTE_PATH}/warn.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> | ||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
<maxFileSize>100MB</maxFileSize> | ||
</timeBasedFileNamingAndTriggeringPolicy> | ||
<maxHistory>${MAX_HISTORY}</maxHistory> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="ERROR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
|
||
<file>${LOGS_ABSOLUTE_PATH}/error.log</file> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>ERROR</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
<encoder> | ||
<Pattern>${LOG_PATTERN}</Pattern> | ||
</encoder> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOGS_ABSOLUTE_PATH}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> | ||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
<maxFileSize>100MB</maxFileSize> | ||
</timeBasedFileNamingAndTriggeringPolicy> | ||
<maxHistory>${MAX_HISTORY}</maxHistory> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="PERFORMANCE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOGS_ABSOLUTE_PATH}/performance.log</file> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOGS_ABSOLUTE_PATH}/performance.%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
<timeBasedFileNamingAndTriggeringPolicy | ||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
<maxFileSize>15MB</maxFileSize> | ||
</timeBasedFileNamingAndTriggeringPolicy> | ||
<maxHistory>7</maxHistory> | ||
</rollingPolicy> | ||
<encoder> | ||
<charset>utf8</charset> | ||
<Pattern>${PERFORMANCE_LOG_PATTERN}</Pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="Sentry" class="io.sentry.logback.SentryAppender"> | ||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
<level>ERROR</level> | ||
</filter> | ||
</appender> | ||
|
||
<root level="ERROR"> | ||
<appender-ref ref="Sentry" /> | ||
</root> | ||
|
||
<root level="INFO"> | ||
<appender-ref ref="STDOUT"/> | ||
<appender-ref ref="INFO_LOG"/> | ||
<appender-ref ref="WARN_LOG"/> | ||
<appender-ref ref="ERROR_LOG"/> | ||
</root> | ||
|
||
</configuration> |