Corrected logging location - broken by initialising logger before logging was configured.

This commit is contained in:
Clinton Alexander 2017-03-30 17:57:32 +01:00
parent da88a43e40
commit e87184d1eb
4 changed files with 6 additions and 8 deletions

View File

@ -2,7 +2,6 @@ apply plugin: 'kotlin'
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'net.corda.plugins.publish-utils' apply plugin: 'net.corda.plugins.publish-utils'
// TODO: Break dependency on node and move to another location such as a submodule of client.
description 'Corda node web server' description 'Corda node web server'
configurations { configurations {
@ -20,12 +19,12 @@ sourceSets {
} }
test { test {
resources { resources {
srcDir "../config/test" srcDir "$rootDir/config/test"
} }
} }
main { main {
resources { resources {
srcDir "../config/dev" srcDir "$rootDir/config/dev"
} }
} }
} }

View File

@ -56,8 +56,6 @@ data class CmdLineOptions(val baseDirectory: Path,
val loggingLevel: Level, val loggingLevel: Level,
val logToConsole: Boolean) { val logToConsole: Boolean) {
private val log = loggerFor<CmdLineOptions>()
fun loadConfig(allowMissingConfig: Boolean = false, configOverrides: Map<String, Any?> = emptyMap()): Config { fun loadConfig(allowMissingConfig: Boolean = false, configOverrides: Map<String, Any?> = emptyMap()): Config {
return loadConfig(baseDirectory, configFile, allowMissingConfig, configOverrides) return loadConfig(baseDirectory, configFile, allowMissingConfig, configOverrides)
} }
@ -77,6 +75,7 @@ data class CmdLineOptions(val baseDirectory: Path,
.withFallback(appConfig) .withFallback(appConfig)
.withFallback(defaultConfig) .withFallback(defaultConfig)
.resolve() .resolve()
val log = loggerFor<CmdLineOptions>()
log.info("Config:\n${finalConfig.root().render(ConfigRenderOptions.defaults())}") log.info("Config:\n${finalConfig.root().render(ConfigRenderOptions.defaults())}")
return finalConfig return finalConfig
} }

View File

@ -34,7 +34,7 @@ fun main(args: Array<String>) {
System.setProperty("consoleLogLevel", "info") System.setProperty("consoleLogLevel", "info")
} }
System.setProperty("log-path", (cmdlineOptions.baseDirectory / "web/logs").toString()) System.setProperty("log-path", (cmdlineOptions.baseDirectory / "logs/web").toString())
val log = LoggerFactory.getLogger("Main") val log = LoggerFactory.getLogger("Main")
println("Logs can be found in ${System.getProperty("log-path")}") println("Logs can be found in ${System.getProperty("log-path")}")

View File

@ -22,12 +22,12 @@ targetCompatibility = 1.6
sourceSets { sourceSets {
test { test {
resources { resources {
srcDir "../../../config/test" srcDir "$rootDir/config/test"
} }
} }
main { main {
resources { resources {
srcDir "../../../config/dev" srcDir "$rootDir/config/dev"
} }
} }
} }