Enabling Debug classes for Indexing Troubleshooting
Purpose
For when automatic indexing is not occurring or you are getting errors related to indexing, these may be circumstances where you need to turn on debug logging for indexing.
Index debug logging is quite verbose, resulting in a significant increase in reindexing time if enabled. During testing, we measured an increase of about 3 times for the same data set, so use this logging only when it is really needed. Contact Atlassian support if you have any questions.
Solution
Confluence 5.10 and above
Enabling debugging for indexing temporarily
From Administration >> Logging and Profiling, add the following package, and set to DEBUG:
com.atlassian.confluence.internal.index.AbstractBatchIndexer
com.atlassian.confluence.search.lucene
com.atlassian.bonnie.search.extractor
For very verbose logging set the full package to DEBUG, instead of just AbstractBatchIndexer (this can cause space issues on instances with lots of data):
com.atlassian.confluence.internal.index
Enabling debugging for indexing permanently
Edit
<CONFLUENCE_INSTALL>/confluence/WEB-INF/classes/log4j.properties
file and addFor simple progress logging:
log4j.logger.com.atlassian.confluence.internal.index.AbstractBatchIndexer=DEBUG, indexlog log4j.logger.com.atlassian.confluence.search.lucene=DEBUG, indexlog log4j.logger.com.atlassian.bonnie.search.extractor=DEBUG, indexlog
For very verbose logging add the full package instead of just AbstractBatchIndexer (this can cause space issues on instances with lots of data):
log4j.logger.com.atlassian.confluence.internal.index=DEBUG, indexlog log4j.logger.com.atlassian.confluence.search.lucene=DEBUG, indexlog log4j.logger.com.atlassian.bonnie.search.extractor=DEBUG, indexlog
- Restart Confluence
Logging should appear in the <CONFLUENCE_HOME>/logs/atlassian-confluence.log
file, like the following:
2017-04-06 13:23:56,853 DEBUG [Caesium-1-1] [confluence.search.lucene.LuceneIndexManager] flushQueue Flush requested
2017-04-06 13:23:56,923 DEBUG [Caesium-1-1] [confluence.search.lucene.PluggableSearcherInitialisation] initialise Warming up searcher..
2017-04-06 13:23:56,923 DEBUG [Caesium-1-1] [confluence.search.lucene.DefaultSearcherInitialisation] initialise Warming up searcher..
2017-04-06 13:23:56,927 DEBUG [Caesium-1-1] [confluence.search.lucene.LuceneIndexManager] flushQueue Flushed 4 items in 72 milliseconds
Logging to a separate file (prior to 7.13)
It is also possible to log index logging to another file as discussed in Configuring log4j in Confluence to send specific entries to a different log file by adding the following to <CONFLUENCE_INSTALL>/confluence/WEB-INF/classes/log4j.properties:
log4j.appender.indexlog=org.apache.log4j.RollingFileAppender
log4j.appender.indexlog.Threshold=DEBUG
log4j.appender.indexlog.File=${catalina.home}/logs/atlassian-confluence-index.log
log4j.appender.indexlog.MaxFileSize=20480KB
log4j.appender.indexlog.MaxBackupIndex=5
log4j.appender.indexlog.layout=com.atlassian.confluence.util.PatternLayoutWithStackTrace
log4j.appender.brokenpipelog.layout.ConversionPattern=%d %p [%t] [%c{4}] %M %m%n
log4j.logger.com.atlassian.confluence.search.lucene=DEBUG, indexlog
log4j.additivity.com.atlassian.confluence.search.lucene=false
log4j.logger.com.atlassian.confluence.internal.index.AbstractBatchIndexer=DEBUG, indexlog
log4j.additivity.com.atlassian.confluence.internal.index.AbstractBatchIndexer=false
This will log to <CONFLUENCE_HOME>/logs/atlassian-confluence-index.log.
Confluence 7.13 and above adds this file logging by default and the classes only need to be turned up via Administration >> Logging and Profiling.