-
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.
* ♻️ logback 파일 모듈별로 분리 및 소켓 방식으로 변경 * feat: change scheduler hostname (#277) * ♻️ profile에 따라 socket appender host name 수정 * ♻️ batch server에서 로그 받도록 socket-server 설정 * 🐛 테스트 실패 수정 * ♻️ test용 배포 브랜치 제거 * ♻️ test용 코드 제거 * ♻️ submodule update --------- Co-authored-by: Joohyun Ha <[email protected]>
- Loading branch information
1 parent
0f44295
commit 4bd8625
Showing
6 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
Submodule ahachul_secret
updated
from d99d9b to e63758
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,100 @@ | ||
<configuration scan="true" scanPeriod="60 seconds"> | ||
|
||
<property resource="logback.properties"/> | ||
|
||
<springProperty scope="context" name="LOG_LEVEL" source="logging.level.root"/> | ||
|
||
<property name="LOG_PATH" value="${log.config.path}"/> | ||
<property name="LOG_FILE_NAME" value="${log.config.filename}"/> | ||
<property name="LOG_ARCHIVE_PATH" value="${log.config.archive.path}"/> | ||
|
||
<property name="ERROR_LOG_PATH" value="${log.config.error.path}"/> | ||
<property name="ERROR_LOG_FILE_NAME" value="${log.config.error.filename}"/> | ||
<property name="ERROR_LOG_ARCHIVE_PATH" value="${log.config.error.archive.path}"/> | ||
|
||
<property name="HASHTAG_LOG_PATH" value="${log.config.hashtag.path}"/> | ||
<property name="HASHTAG_LOG_FILE_NAME" value="${log.config.hashtag.filename}"/> | ||
|
||
<springProfile name="dev"> | ||
<property name="HASHTAG_LOG_HOST_NAME" value="${log.config.hashtag.hostname}"/> | ||
</springProfile> | ||
|
||
<springProfile name="local, test"> | ||
<property name="HASHTAG_LOG_HOST_NAME" value="${log.config.hashtag.hostname.local}"/> | ||
</springProfile> | ||
|
||
<property name="HASHTAG_LOG_PORT" value="${log.config.hashtag.port}"/> | ||
|
||
<property name="LOG_PATTERN" value="%-5level %d{yy-MM-dd HH:mm:ss}[%thread] [%logger{0}:%line] - %msg%n"/> | ||
<property name="HASHTAG_LOG_PATTERN" value="%d{yy-MM-dd HH:mm:ss} [%logger{0}:%line] %msg%n"/> | ||
|
||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
<pattern>${LOG_PATTERN}</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_PATH}/${LOG_FILE_NAME}.log</file> | ||
|
||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
<pattern>${LOG_PATTERN}</pattern> | ||
</encoder> | ||
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_ARCHIVE_PATH}/${LOG_FILE_NAME}.%d{yyyy-MM-dd}_%i.log</fileNamePattern> | ||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
<maxFileSize>10MB</maxFileSize> | ||
</timeBasedFileNamingAndTriggeringPolicy> | ||
<maxHistory>30</maxHistory> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${ERROR_LOG_PATH}/${ERROR_LOG_FILE_NAME}.log</file> | ||
|
||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
<pattern>${LOG_PATTERN}</pattern> | ||
</encoder> | ||
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${ERROR_LOG_ARCHIVE_PATH}/${ERROR_LOG_FILE_NAME}.%d{yyyy-MM-dd}_%i.log</fileNamePattern> | ||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
<maxFileSize>10MB</maxFileSize> | ||
</timeBasedFileNamingAndTriggeringPolicy> | ||
<maxHistory>60</maxHistory> | ||
</rollingPolicy> | ||
|
||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>error</level> | ||
<onMatch>ACCEPT</onMatch> | ||
<onMismatch>DENY</onMismatch> | ||
</filter> | ||
</appender> | ||
|
||
<appender name="HASHTAG_SOCKET" class="ch.qos.logback.classic.net.SocketAppender"> | ||
<remoteHost>${HASHTAG_LOG_HOST_NAME}</remoteHost> | ||
<port>${HASHTAG_LOG_PORT}</port> | ||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
<pattern>${HASHTAG_LOG_PATTERN}</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="HASHTAG_ASYNC_SOCKET" class="ch.qos.logback.classic.AsyncAppender"> | ||
<queueSize>512</queueSize> | ||
<discardingThreshold>0</discardingThreshold> | ||
<neverBlock>true</neverBlock> | ||
<appender-ref ref="HASHTAG_SOCKET"/> | ||
</appender> | ||
|
||
<root level="{LOG_LEVEL}"> | ||
<appender-ref ref="CONSOLE"/> | ||
<appender-ref ref="FILE"/> | ||
<appender-ref ref="ERROR_FILE"/> | ||
</root> | ||
|
||
<logger name="HASHTAG_LOGGER" LEVEL="INFO"> | ||
<appender-ref ref="HASHTAG_ASYNC_SOCKET"/> | ||
</logger> | ||
|
||
</configuration> |
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
9 changes: 8 additions & 1 deletion
9
scheduler/src/main/kotlin/backend/team/ahachul_backend/ScheduleModuleApplication.kt
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,11 +1,18 @@ | ||
package backend.team.ahachul_backend | ||
|
||
import backend.team.ahachul_backend.common.properties.SocketServerProperties | ||
import ch.qos.logback.classic.net.SimpleSocketServer | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
import org.springframework.boot.runApplication | ||
import org.springframework.context.ApplicationContext | ||
|
||
@SpringBootApplication | ||
@EnableConfigurationProperties | ||
class ScheduleModuleApplication | ||
|
||
fun main(args: Array<String>) { | ||
runApplication<ScheduleModuleApplication>(*args) | ||
val context: ApplicationContext = runApplication<ScheduleModuleApplication>(*args) | ||
val properties = context.getBean(SocketServerProperties::class.java) | ||
SimpleSocketServer.main(arrayOf(properties.port, properties.configPath)) | ||
} |
11 changes: 11 additions & 0 deletions
11
.../src/main/kotlin/backend/team/ahachul_backend/common/properties/SocketServerProperties.kt
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,11 @@ | ||
package backend.team.ahachul_backend.common.properties | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
@ConfigurationProperties(prefix = "socket-server") | ||
data class SocketServerProperties( | ||
var port: String = "", | ||
var configPath: String = "" | ||
) |
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