April 13, 2020
Estimated Post Reading Time ~

log4j.xml for crx (logging QueryImpl)

I wanted to see the impact of repository size on query performance.
You can configure crx logging to log query times.
http://wiki.apache.org/jackrabbit/Search#Analyzing_Query_Performance

cq/crx-quickstart/server/runtime/0/_crx/WEB-INF/log4j.xml
    <appender name="query" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="crx-quickstart/logs/crx/query.log"/>
        <param name="maxFileSize" value="10MB"/>
        <param name="maxBackupIndex" value="100"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m (%F, line %L)%n"/>
        </layout>
    </appender>
    <logger name="org.apache.jackrabbit.core.query.QueryImpl" additivity="false">
        <level value="debug"/>
        <appender-ref ref="query" />
    </logger>

it'll be logged to cq/crx-quickstart/logs/crx/query.log
 additivity="false" will skip console logging (if root logger has console logger).

Example log:
02.12.2011 14:46:37 *DEBUG* QueryImpl: executed in 0.01 s. (/jcr:root/content/dam//*[(@jcr:primaryType='dam:AssetContent' and jcr:contains(metadata/@dc:format, 'image'))] order by @jcr:lastModified descending) (QueryImpl.java, line 143)


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.