Logging

The indexing and searching application uses log4j2, the default log configuration is as follows. Log4j2 is used due to use of the disruptor framework to perform logging asynchronously. In order for the default logging configuration to kick in the following property is required

-DLog4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"

If you don’t like the look of the below configuration you can specify your own configuration file via:

-Dlog4j.configurationFile=<absolute path to my file>

If the below configuration looks adequate, then you can customs the configurations with the following system properties:

-Drelated-item.searching.log.file=<absolute location of file>
-Drelated-item.searching.log.level=ERROR
-Drelated-item.indexing.log.file=<absolute location of file>
-Drelated-item.indexing.log.level=ERROR

The defaults are “WARN” and searching.log/indexing.log either in CATALINA_BASE/logs/ or java.io.tmpdir

The log4j2.xml configuration files are as follows:

Searching


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration status="WARN" monitorInterval="120">
        <appenders>
            <RollingRandomAccessFile name="SEARCHING" fileName="${sys:related-item.searching.log.file}"
                                 immediateFlush="false" append="true"
                                 filePattern="${sys:related-item.searching.log.file}-%d{yyyy-MM-dd}-%i.log.gz">
                <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
                <Policies>
                    <TimeBasedTriggeringPolicy />
                    <SizeBasedTriggeringPolicy size="50 MB"/>
                </Policies>
            </RollingRandomAccessFile>
        </appenders>
        <loggers>
            <root level="${sys:related-item.searching.log.level}" includeLocation="false">
                <appender-ref ref="SEARCHING"/>
            </root>
        </loggers>
    </configuration>

Indexing


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration status="WARN" monitorInterval="120">
        <appenders>
            <RollingRandomAccessFile name="INDEXING" fileName="${sys:related-item.indexing.log.file}"
                                 immediateFlush="false" append="true"
                                 filePattern="${sys:related-item.indexing.log.file}-%d{yyyy-MM-dd}-%i.log.gz">
                <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
                <Policies>
                    <TimeBasedTriggeringPolicy />
                    <SizeBasedTriggeringPolicy size="50 MB"/>
                </Policies>
            </RollingRandomAccessFile>
        </appenders>
        <loggers>
            <root level="${sys:related-item.indexing.log.level}" includeLocation="false">
                <appender-ref ref="INDEXING"/>
            </root>
        </loggers>
    </configuration>