Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Log SQL statements

Administrators can optionally log all SQL statements used in sql macros. This option is enabled by adding configuration in the ../WEB-INF/classes/log4j.properties file. In addition, warnings are issued when the default row limit is exceeded.

Tip
titleUse logging when establishing or lowering row limit

Setting or lowering the row limit in an installation may cause a few existing SQL queries to show only the limited number of rows. Use logging to track usage that exceeds the limit. Investigate queries that exceed the default limit for correctness. If correct, use the limit parameter to prevent further warnings.

Example

No Format
titleAdd to ../WEB-INF/classes/log4j.properties

# SQL statement logging
log4j.appender.sqlplugin=org.apache.log4j.RollingFileAppender
log4j.appender.sqlplugin.File=${catalina.home}/home/logs/sql-plugin.log
log4j.appender.sqlplugin.Threshold=INFO
log4j.appender.sqlplugin.MaxFileSize=20480KB
log4j.appender.sqlplugin.MaxBackupIndex=10
log4j.appender.sqlplugin.layout=com.atlassian.confluence.util.PatternLayoutWithContext
log4j.appender.sqlplugin.layout.ConversionPattern=%d %p %m%n

log4j.logger.org.swift.confluence.sql.SqlMacro.statement=INFO, sqlplugin
log4j.additivity.org.swift.confluence.sql.SqlMacro.statement=false

log4j.logger.org.swift.confluence.sql.SqlQueryMacro.statement=INFO, sqlplugin
log4j.additivity.org.swift.confluence.sql.SqlQueryMacro.statement=false

...

titleAdditivity

...

Include Page
SUPPORT:How to log SQL activity
SUPPORT:How to log SQL activity