CORDA-3246 - Missing logs on shutdown (#5501)

* Disabled shutdown hook on log4j2 as se are calling LogManager.shutdown manually and having multiple shutdowns breaks the logic and misses flushing out events.

* Added docs entry about shutdownHook needing to be disabled in case of a config override.

* Changes according to PR.

* More changes according to PR.

* Changed note according to PR review.
This commit is contained in:
Stefan Iliev 2019-10-08 10:18:19 +01:00 committed by Anthony Keenan
parent ec4d20d987
commit 31014e1022
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" packages="net.corda.common.logging">
<Configuration status="info" packages="net.corda.common.logging" shutdownHook="disable">
<Properties>
<Property name="log-path">${sys:log-path:-logs}</Property>

View File

@ -25,6 +25,11 @@ If you need to switch to synchronous logging (e.g. for debugging/testing purpose
by adding ``-DLog4jContextSelector=org.apache.logging.log4j.core.selector.ClassLoaderContextSelector`` to the node's
command line or to the ``jvmArgs`` section of the node configuration (see :doc:`corda-configuration-file`).
.. warning:: Ensure that ``shutdownHook="disable"`` is set if you are overriding the log4j2 configuration file
otherwise logs will not be flushed properly on shutdown and loss may occur. The option is set in the ``Configuration``
tag of the log4j configuration file, for example ``<Configuration ... shutdownHook="disable">``. This is because
Corda overrides the default log4j2 shutdown logic in order to make sure it gets shut down correctly.
Example
+++++++