Skip to content

Commit

Permalink
It is now possible to specify a non-default log4j2 config in the conf…
Browse files Browse the repository at this point in the history
…ig.json.
  • Loading branch information
ppanopticon committed Feb 4, 2021
1 parent 2e4d96c commit dc63be2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/kotlin/ch/pontius/swissqr/api/SwissQRService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ fun main(args: Array<String>) {
kotlinx.serialization.json.Json.decodeFromString(Config.serializer(), reader.readText())
}

/* Prepare Log4j logging facilities. */
if (config.logConfig != null && Files.isRegularFile(config.logConfig)) {
System.getProperties().setProperty("log4j.configurationFile", config.logConfig.toString())
}

/* Initialize data access layer. */
val dataAccessLayer = DataAccessLayer(config.data)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ data class Config(

/** Path to the data folder. */
@Serializable(with = PathSerializer::class)
val data: Path = Paths.get("./data")
val data: Path = Paths.get("./data"),

/** Path to a custom Log4j2 config file (XML). Defaults to null! */
val logConfig: Path? = null
)

0 comments on commit dc63be2

Please sign in to comment.