Skip to content

Commit

Permalink
Logback with json output
Browse files Browse the repository at this point in the history
  • Loading branch information
jsixface committed Aug 18, 2024
1 parent 50ced36 commit 3255c03
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ksp = "2.0.0-1.0.21"
ktor = "3.0.0-wasm2"
ktor-beta = "3.0.0-beta-1"
logback = "1.4.14"
logstash-logback-encoder = "8.0"
napier = "2.7.1"

[libraries]
Expand Down Expand Up @@ -39,6 +40,7 @@ ktor-server-netty = { module = "io.ktor:ktor-server-netty-jvm", version.ref = "k
ktor-server-resources = { module = "io.ktor:ktor-server-resources", version.ref = "ktor" }
ktor-server-tests = { module = "io.ktor:ktor-server-tests-jvm", version.ref = "ktor" }
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
logstash-logback-encoder = { module = "net.logstash.logback:logstash-logback-encoder", version.ref = "logstash-logback-encoder" }
napier = { module = "io.github.aakira:napier", version.ref = "napier" }

[bundles]
Expand Down
1 change: 1 addition & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ application {
dependencies {
implementation(projects.shared)
implementation(libs.logback)
implementation(libs.logstash.logback.encoder)
implementation(libs.bundles.ktor.server)
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.json)
Expand Down
7 changes: 4 additions & 3 deletions server/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<!-- <encoder>-->
<!-- <pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>-->
<!-- </encoder>-->
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<root level="debug">
<appender-ref ref="STDOUT"/>
Expand Down

0 comments on commit 3255c03

Please sign in to comment.