Skip to end of banner
Go to start of banner

How to log SQL activity

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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.

Use 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

Add 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

Additivity

Setting additivity to false prevents sql being logged to your main confluence log.

  • No labels