Logging in QPL

From wiki.searchtechnologies.com
Jump to: navigation, search

For Information on Aspire 3.1 Click Here

This Page is Locked - Content no longer maintained - See QPL for the latest information.
Enterprise Add-On Feature

QPL script

You can log messages to Solr/LucidWorks logs using following example:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

final Logger logger = LoggerFactory.getLogger("YouLoggerName");
logger.info("log message");


Log config

In LucidWorks, the log message will be logged into core.yyyy_mm_dd.log by default. You can change the conf/log4j-core.xml to customize your logging.

For example, you can add a new appender to log your messages into a different file:

<appender class="org.apache.log4j.rolling.RollingFileAppender" name="qpllog">
  <param value="UTF-8" name="encoding"/>
  <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
    <param value="${lucidworksLogsHome}/qpl.%d{yyyy_MM_dd}.log" name="FileNamePattern"/>
    <param name="MaxBackupIndex" value="2"/>
  </rollingPolicy>
  <layout class="org.apache.log4j.PatternLayout">
    <param value="%d{ISO8601} %p %c{2} - %m%n" name="ConversionPattern"/>
  </layout>
</appender>
 
<logger name="YouLoggerName">
  <level value="INFO"/>
  <appender-ref ref="qpllog"/>
</logger>