corda

Corda Enterprise generates a details-node-.log file


at the beginning of the project we worked with Corda Opensource, and we used the command line argument logging-level=WARN to change the log level of the nodes. When we started using Corda Enterprise, we noticed that a details-node-.log file was created. It is a log file that grows fast and is at TRACE level. Our question: can the log in this file affect the performance of our cordapps and can we change the level of this log or disable it?


Solution

  • Corda Enterprise adds that logger which is not present in Open Source Corda.

    The only impact I can see for a CordApp could be probably the lack of space on the server, so if in your case this log file becomes too big too quickly, it would be a good idea to configure it to avoid possible problems.

    You can override the log4j configuration file and give it as input to the jar like this:

    java -jar Dlog4j.configurationFile=new-log-config.xml <en-service>.jar

    It is standard log4j, so you can also configure the rollover period and the size. For reference, you can also take a look to this log4j.xml in open source Corda to see how the loggers are configured.

    So, can probably override the logger you're concerned about with the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <Properties>
        ...
        <Property name="detailLogLevel">TRACE</Property>
    </Properties>
    
    <Appenders>
        ...
        <RollingRandomAccessFile name="Detailed-RollingFile-Appender"
                    fileName="${log-path}/details-${log-name}.log"
                    filePattern="${archive}/details-${log-name}.%date{yyyy-MM-dd}-%i.log.gz">
    
            <Policies>
                ...your policies...
            </Policies>
    
            <DefaultRolloverStrategy>
                ...your strategy...
            </DefaultRolloverStrategy>
    
        </RollingRandomAccessFile>
    </Appenders>
    
    <Loggers>
        ...
        <Logger name="DetailedInfo" additivity="false" level="${detailLogLevel}">
            <AppenderRef ref="Detailed-RollingFile-Appender"/>
        </Logger>
    </Loggers>