-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add: log4jdbc gradle 의존 추가 * refactor: 전역 예외 처리 로그 레벨 별 메서드 리팩터링 * add: logback, log4jdbc 설정 추가 - info file appender - warn file appender - error file appender - console appender - sql file appender - log4jdbc properties - logback
- Loading branch information
Showing
10 changed files
with
137 additions
and
26 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
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,7 @@ | ||
<included> | ||
<appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | ||
</encoder> | ||
</appender> | ||
</included> |
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,22 @@ | ||
<included> | ||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_PATH}/error/error.txt</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.SizeAndTimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_PATH}/error/error.%d{yyyy-MM-dd}.%i.txt</fileNamePattern> | ||
<maxFileSize>100MB</maxFileSize> | ||
<maxHistory>10</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
</included> |
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,17 @@ | ||
<included> | ||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
|
||
<encoder> | ||
<pattern>${LOG_PATTERN}</pattern> | ||
</encoder> | ||
|
||
<file>${LOG_PATH}/info/info.txt</file> | ||
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_PATH}/info/info.%d{yyyy-MM-dd}.%i.txt</fileNamePattern> | ||
<maxFileSize>100MB</maxFileSize> | ||
<maxHistory>10</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
</included> |
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,18 @@ | ||
<included> | ||
<property name="SQL_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss}] [%thread] [%-28.28logger{0}] - %m%n"/> | ||
|
||
<appender name="SQL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_PATH}/db/sql.txt</file> | ||
|
||
<encoder> | ||
<pattern>${SQL_LOG_PATTERN}</pattern> | ||
</encoder> | ||
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_PATH}/db/sql.%d{yyyy-MM-dd}.%i.txt</fileNamePattern> | ||
<maxFileSize>100MB</maxFileSize> | ||
<maxHistory>10</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
</included> |
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,22 @@ | ||
<included> | ||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_PATH}/warn/warn.txt</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.SizeAndTimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_PATH}/warn/warn.%d{yyyy-MM-dd}.%i.txt</fileNamePattern> | ||
<maxFileSize>100MB</maxFileSize> | ||
<maxHistory>10</maxHistory> | ||
<totalSizeCap>1GB</totalSizeCap> | ||
</rollingPolicy> | ||
</appender> | ||
</included> |
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,2 @@ | ||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator | ||
log4jdbc.dump.sql.maxlinelength=0 |
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 |
---|---|---|
@@ -1,18 +1,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> | ||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> | ||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> | ||
<conversionRule conversionWord="wex" | ||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> | ||
<conversionRule conversionWord="wEx" | ||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> | ||
|
||
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}:%L){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/> | ||
<property name="LOG_PATTERN" | ||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } [%15.15t] %-40.40logger{39}:%L{cyan} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/> | ||
<property name="CONSOLE_LOG_PATTERN" | ||
value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}) %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}:%L){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/> | ||
|
||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | ||
</encoder> | ||
</appender> | ||
<include resource="appender/console-appender.xml"/> | ||
|
||
<root level="INFO"> | ||
<appender-ref ref="console"/> | ||
</root> | ||
</configuration> | ||
<springProfile name="local"> | ||
<root level="INFO"> | ||
<logger name="jdbc.sqltiming" level="INFO" additivity="true"> | ||
<appender-ref ref="CONSOLE_APPENDER"/> | ||
</logger> | ||
<logger name="jdbc.resultsettable" level="INFO" additivity="true"> | ||
<appender-ref ref="CONSOLE_APPENDER"/> | ||
</logger> | ||
</root> | ||
</springProfile> | ||
|
||
<springProfile name="prod"> | ||
<property name="LOG_PATH" value="./logs"/> | ||
<include resource="appender/info-file-appender.xml"/> | ||
<include resource="appender/warn-file-appender.xml"/> | ||
<include resource="appender/error-file-appender.xml"/> | ||
<include resource="appender/sql-file-appender.xml"/> | ||
<root level="INFO"> | ||
<appender-ref ref="CONSOLE_APPENDER"/> | ||
<appender-ref ref="INFO_FILE"/> | ||
<appender-ref ref="WARN_FILE"/> | ||
<appender-ref ref="ERROR_FILE"/> | ||
</root> | ||
|
||
<logger name="jdbc" level="OFF"/> | ||
<logger name="jdbc.connection" level="OFF"/> | ||
<logger name="jdbc.sqltiming" level="INFO" additivity="false"> | ||
<appender-ref ref="SQL_FILE"/> | ||
</logger> | ||
<logger name="jdbc.resultsettable" level="INFO" additivity="false"> | ||
<appender-ref ref="SQL_FILE"/> | ||
</logger> | ||
</springProfile> | ||
|
||
</configuration> |