Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore | #1 | @lcomment | Logging 모듈 구성 #3

Merged
merged 6 commits into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -14,3 +14,6 @@ ktlintVersion=11.6.0
### Spring Dependency Versions ###
springBootVersion=3.2.0
springDependencyManagementVersion=1.1.4

### External Dependency versions ###
sentryVersion=6.33.0
2 changes: 2 additions & 0 deletions lovebird-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@ tasks.getByName("jar") {
}

dependencies {
implementation(project(":lovebird-infra:logging"))

implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation")
}
3 changes: 3 additions & 0 deletions lovebird-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -6,3 +6,6 @@ spring:
version: 1.0.0
banner:
location: classpath:/app-banner.dat
config:
import:
- logging-${spring.profiles.default}.yml
6 changes: 6 additions & 0 deletions lovebird-infra/logging/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description = "logging module"

dependencies {
implementation("io.micrometer:micrometer-tracing-bridge-brave")
implementation("io.sentry:sentry-logback:${property("sentryVersion")}")
}
27 changes: 27 additions & 0 deletions lovebird-infra/logging/src/main/resources/logback/logback-dev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%clr(%d{HH:mm:ss.SSS}){faint}|%clr(${level:-%5p})|%32X{traceId:-},%16X{spanId:-}|%clr(%-40.40logger{39}){cyan}%clr(|){faint}%m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
<charset>utf8</charset>
</encoder>
</appender>

<appender name="SENTRY" class="io.sentry.logback.SentryAppender">
<options>
<dsn>YOUR_DSN</dsn>
</options>
<minimumEventLevel>WARN</minimumEventLevel>
<minimumBreadcrumbLevel>INFO</minimumBreadcrumbLevel>
</appender>

<logger name="org.springframework" level="WARN"/>
<logger name="com.lovebird" level="INFO"/>

<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="SENTRY"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%clr(%d{HH:mm:ss.SSS}){faint}|%clr(${level:-%5p})|%32X{traceId:-},%16X{spanId:-}|%clr(%-40.40logger{39}){cyan}%clr(|){faint}%m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
<charset>utf8</charset>
</encoder>
</appender>

<logger name="org.springframework" level="INFO"/>
<logger name="com.lovebird" level="DEBUG"/>

<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
27 changes: 27 additions & 0 deletions lovebird-infra/logging/src/main/resources/logback/logback-prod.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%clr(%d{HH:mm:ss.SSS}){faint}|%clr(${level:-%5p})|%32X{traceId:-},%16X{spanId:-}|%clr(%-40.40logger{39}){cyan}%clr(|){faint}%m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
<charset>utf8</charset>
</encoder>
</appender>

<appender name="SENTRY" class="io.sentry.logback.SentryAppender">
<options>
<dsn>YOUR_DSN</dsn>
</options>
<minimumEventLevel>WARN</minimumEventLevel>
<minimumBreadcrumbLevel>INFO</minimumBreadcrumbLevel>
</appender>

<logger name="org.springframework" level="WARN"/>
<logger name="com.lovebird" level="INFO"/>

<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="SENTRY"/>
</root>
</configuration>
2 changes: 2 additions & 0 deletions lovebird-infra/logging/src/main/resources/logging-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
logging:
config: classpath:logback/logback-dev.xml
2 changes: 2 additions & 0 deletions lovebird-infra/logging/src/main/resources/logging-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
logging:
config: classpath:logback/logback-local.xml
2 changes: 2 additions & 0 deletions lovebird-infra/logging/src/main/resources/logging-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
logging:
config: classpath:logback/logback-prod.xml