diff --git a/config/dev/log4j2.xml b/config/dev/log4j2.xml index 7220687f8d..a23af7db94 100644 --- a/config/dev/log4j2.xml +++ b/config/dev/log4j2.xml @@ -2,11 +2,10 @@ - logs + ${sys:log-path:-logs} node-${hostName} - ${sys:log-path}/archive - error - info + ${log-path}/archive + ${sys:defaultLogLevel:-info} @@ -14,7 +13,7 @@ - + - + @@ -39,7 +38,7 @@ @@ -64,15 +63,23 @@ - - - + + + + + + + + + + + diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 67e44fb3aa..41e50593b6 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -7,6 +7,8 @@ release, see :doc:`upgrade-notes`. Unreleased ========== +* Fixed an issue preventing out of process nodes started by the ``Driver`` from logging to file. + * Fixed an issue with ``CashException`` not being able to deserialise after the introduction of AMQP for RPC. * Removed -xmx VM argument from Explorer's Capsule setup. This helps avoiding out of memory errors. diff --git a/node/src/integration-test/kotlin/net/corda/node/BootTests.kt b/node/src/integration-test/kotlin/net/corda/node/BootTests.kt index be0825f4ff..51ccf7b974 100644 --- a/node/src/integration-test/kotlin/net/corda/node/BootTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/BootTests.kt @@ -12,12 +12,10 @@ import net.corda.core.messaging.startFlow import net.corda.core.utilities.getOrThrow import net.corda.node.internal.NodeStartup import net.corda.node.services.Permissions.Companion.startFlow -import net.corda.testing.common.internal.ProjectStructure.projectRootDir import net.corda.testing.core.ALICE_NAME import net.corda.testing.driver.DriverParameters import net.corda.testing.driver.driver import net.corda.testing.node.User -import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.junit.Test import java.io.* @@ -38,9 +36,7 @@ class BootTests { @Test fun `double node start doesn't write into log file`() { - val logConfigFile = projectRootDir / "config" / "dev" / "log4j2.xml" - assertThat(logConfigFile).isRegularFile() - driver(DriverParameters(isDebug = true, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString()))) { + driver(DriverParameters(isDebug = true)) { val alice = startNode(providedName = ALICE_NAME).get() val logFolder = alice.baseDirectory / NodeStartup.LOGS_DIRECTORY_NAME val logFile = logFolder.list { it.filter { it.fileName.toString().endsWith(".log") }.findAny().get() } diff --git a/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt b/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt index 368821069d..da89c5a780 100644 --- a/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt +++ b/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt @@ -2,9 +2,11 @@ package net.corda.vega import com.opengamma.strata.product.common.BuySell import net.corda.core.identity.CordaX500Name +import net.corda.core.internal.div import net.corda.core.internal.packageName import net.corda.core.utilities.getOrThrow import net.corda.serialization.internal.amqp.AbstractAMQPSerializationScheme +import net.corda.testing.common.internal.ProjectStructure.projectRootDir import net.corda.testing.core.DUMMY_BANK_A_NAME import net.corda.testing.core.DUMMY_BANK_B_NAME import net.corda.testing.driver.DriverParameters @@ -43,7 +45,13 @@ class SimmValuationTest { @Test fun `runs SIMM valuation demo`() { - driver(DriverParameters(isDebug = true, extraCordappPackagesToScan = listOf("net.corda.vega.contracts", "net.corda.vega.plugin.customserializers"))) { + val logConfigFile = projectRootDir / "samples" / "simm-valuation-demo" / "src" / "main" / "resources" / "log4j2.xml" + assertThat(logConfigFile).isRegularFile() + driver(DriverParameters( + isDebug = true, + extraCordappPackagesToScan = listOf("net.corda.vega.contracts", "net.corda.vega.plugin.customserializers"), + systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())) + ) { val nodeAFuture = startNode(providedName = nodeALegalName) val nodeBFuture = startNode(providedName = nodeBLegalName) val (nodeA, nodeB) = listOf(nodeAFuture, nodeBFuture).map { it.getOrThrow() } diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/ProcessUtilities.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/ProcessUtilities.kt index 20d2bd31c1..4bb77cd503 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/ProcessUtilities.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/ProcessUtilities.kt @@ -22,9 +22,7 @@ object ProcessUtilities { workingDirectory: Path?, maximumHeapSize: String ): Process { - // FIXME: Instead of hacking our classpath, use the correct classpath for className. - val classpath = defaultClassPath.split(pathSeparator).filter { !(it / "log4j2-test.xml").exists() }.joinToString(pathSeparator) - return startJavaProcessImpl(className, arguments, classpath, jdwpPort, extraJvmArguments, workingDirectory, maximumHeapSize) + return startJavaProcessImpl(className, arguments, defaultClassPath, jdwpPort, extraJvmArguments, workingDirectory, maximumHeapSize) } fun startJavaProcessImpl( diff --git a/testing/test-common/src/main/resources/log4j2-test.xml b/testing/test-common/src/main/resources/log4j2-test.xml index a05f8bd585..0d4feace63 100644 --- a/testing/test-common/src/main/resources/log4j2-test.xml +++ b/testing/test-common/src/main/resources/log4j2-test.xml @@ -1,12 +1,19 @@ + - info + ${sys:log-path:-logs} + node-${hostName} + ${log-path}/archive + ${sys:defaultLogLevel:-info} + + + - + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + +