Commit 0077f80a authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Improve logging

parent 73596a1b
Pipeline #33868 passed with stages
in 3 minutes and 16 seconds
...@@ -21,12 +21,11 @@ import kotlin.system.exitProcess ...@@ -21,12 +21,11 @@ import kotlin.system.exitProcess
class App { class App {
companion object { companion object {
private val log = LogManager.getLogger("ReportProcessorApp") private val log = LogManager.getLogger(this::class.java)
@JvmStatic fun main(args: Array<String>) { @JvmStatic fun main(args: Array<String>) {
try { try {
Service().run() Service().run()
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace()
log.error("Stopping application due to error: " + ex.message) log.error("Stopping application due to error: " + ex.message)
exitProcess(1) exitProcess(1)
} }
......
...@@ -30,7 +30,7 @@ class KafkaTopology( ...@@ -30,7 +30,7 @@ class KafkaTopology(
private val settings: SettingsLoader private val settings: SettingsLoader
) { ) {
private val klaxon = Klaxon() private val klaxon = Klaxon()
private val log = LogManager.getLogger("ReportProcessorApp") private val log = LogManager.getLogger(this::class.java)
fun prepare(): StreamsBuilder { fun prepare(): StreamsBuilder {
val builder = StreamsBuilder() val builder = StreamsBuilder()
......
...@@ -21,7 +21,7 @@ import org.apache.logging.log4j.LogManager ...@@ -21,7 +21,7 @@ import org.apache.logging.log4j.LogManager
import ch.memobase.settings.SettingsLoader import ch.memobase.settings.SettingsLoader
class Service(file: String = "app.yml") { class Service(file: String = "app.yml") {
private val log = LogManager.getLogger("ReportProcessorService") private val log = LogManager.getLogger(this::class.java)
val settings = SettingsLoader( val settings = SettingsLoader(
listOf(), listOf(),
...@@ -33,7 +33,6 @@ class Service(file: String = "app.yml") { ...@@ -33,7 +33,6 @@ class Service(file: String = "app.yml") {
stream.use { stream.use {
it.start() it.start()
while (stream.state().isRunningOrRebalancing) { while (stream.state().isRunningOrRebalancing) {
log.info("Service is running.")
Thread.sleep(10_000L) Thread.sleep(10_000L)
} }
throw Exception("Stream stopped running!") throw Exception("Stream stopped running!")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment