Added some more details regarding setting log levels for individual modules

This commit is contained in:
Richard Green 2017-11-10 15:50:01 +00:00
parent 8a5bbe7cf8
commit 4e67a979a0

View File

@ -10,9 +10,43 @@ Logging
By default the node log files are stored to the ``logs`` subdirectory of the working directory and are rotated from time
to time. You can have logging printed to the console as well by passing the ``--log-to-console`` command line flag.
The default logging level is ``INFO`` which can be adjusted by the ``--logging-level`` command line argument. For more
custom logging, the logger settings can be completely overridden with a `Log4j 2 <https://logging.apache.org/log4j/2.x>`_
configuration file assigned to the ``log4j.configurationFile`` system property.
The default logging level is ``INFO`` which can be adjusted by the ``--logging-level`` command line argument. This configuration
option will affect all modules.
It may be the case that you require to amend the log level of a particular subset of modules (e.g. if you'd like to take a
closer look at hibernate activity). So, for more bespoke logging configuration, the logger settings can be completely overridden
with a `Log4j 2 <https://logging.apache.org/log4j/2.x>`_ configuration file assigned to the ``log4j.configurationFile`` system property.
Example
+++++++
Create a file ``sql.xml`` in the current working directory. Add the following text :
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="org.hibernate" level="debug" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
Note the addition of a logger named ``org.hibernate`` that has set this particular logger level to ``debug``.
Now start the node as usual but with the additional parameter ``log4j.configurationFile`` set to the filename as above, e.g.
``java <Your existing startup options here> -Dlog4j.configurationFile=sql.xml -jar corda.jar``
Database access
---------------