Configured logging for desktop app

This commit is contained in:
dankito 2024-08-26 16:57:39 +02:00
parent 2869544a1c
commit ee4287ada1
3 changed files with 51 additions and 2 deletions

View File

@ -83,6 +83,8 @@ kotlin {
desktopMain.dependencies {
implementation(compose.desktop.currentOs)
implementation(libs.kotlinx.coroutines.swing)
implementation(libs.logback)
}
}
}

View File

@ -0,0 +1,43 @@
<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- Insert the current time formatted as "yyyyMMdd'T'HHmmss" under
the key "bySecond" into the logger context. This value will be
available to all subsequent configuration elements. -->
<timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/>
<appender name="file" class="ch.qos.logback.core.FileAppender">
<file>data/logs/Bankmeister-${bySecond}.log</file>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<!-- enable or disable if FinTS message sent to and received from bank servers should get logged by setting level to 'debug' -->
<logger name="net.codinux.banking.fints.log.MessageLogCollector" level="debug">
<appender-ref ref="stdout" />
<appender-ref ref="file" />
</logger>
<!-- Do not log detailed messages of Logback's configuration (= the same what is stated in this file) -->
<logger name="ch.qos.logback.core.model.processor" level="warn">
<appender-ref ref="stdout" />
</logger>
<root level="INFO">
<appender-ref ref="stdout"/>
<!-- <appender-ref ref="file"/>-->
</root>
<root level="WARN">
<appender-ref ref="file"/>
</root>
</configuration>

View File

@ -5,9 +5,11 @@ kotlinx-coroutines = "1.8.1"
banking-client = "0.5.1-SNAPSHOT"
kcsv = "2.2.0"
klf = "1.6.0"
kotlinx-serializable = "1.7.1"
klf = "1.6.0"
logback = "1.5.7"
agp = "8.2.2"
android-compileSdk = "34"
android-minSdk = "24"
@ -29,9 +31,11 @@ banking-client-model = { group = "net.codinux.banking.client", name = "banking-c
fints4k-banking-client = { group = "net.codinux.banking.client", name = "fints4k-banking-client", version.ref = "banking-client" }
kcsv = { group = "net.codinux.csv", name = "kcsv", version.ref = "kcsv" }
klf = { group = "net.codinux.log", name = "klf", version.ref = "klf" }
kotlinx-serializable = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serializable" }
klf = { group = "net.codinux.log", name = "klf", version.ref = "klf" }
logback = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" }