Configuring Logging
There are many situations where you may want to change what is written to the Confluence application logs, particularly when troubleshooting a specific problem.
You can temporarily change the logging behaviour in the Logging and Profiling screen, while Confluence is running. Your changes will be discarded when you restart Confluence.
Alternatively, you can permanently change the logging behaviour in the log4j properties file.
On this page:
Terminology: In log4j, a 'logger' is a named entity. Logger names are case-sensitive and they follow a hierarchical naming standard. For example, the logger named com.foo
is a parent of the logger named com.foo.bar
.
Temporarily change logging behaviour while Confluence is running
When troubleshooting a problem, you can temporarily change the logging behaviour while Confluence is running. These changes aren't written to the log4j.properties
file so are discarded when you next stop Confluence.
Change the logging level of an existing class or package
You need System Administrator global permissions to do this. See log4j Logging Levels for information on the specific levels.
To change the logging level of an existing class or package:
- Go to > General Configuration > Logging and Profiling.
- Locate the relevant class or package, and select a value from the New Level dropdown.
- Save your changes.
Alternatively, choose Remove if you want to stop logging a particular class or package.
Remember, your changes will not be written to the log4j.properties
file so will be discarded when you next stop Confluence.
Add logging for an additional class or package
Sometimes our support team may ask you to enable some additional logging when troubleshooting a specific problem. You need System Administrator global permissions to do this.
To set the logging level for a new class or package:
- Go to > General Configuration > Logging and Profiling.
- Enter the name in the Class/Package name field. It will be something like
com.atlassian.confluence.example
. - Select Add entry to add the new class or package to the list.
- Locate the relevant class or package, and select a value from the New Level dropdown.
- Save your changes.
Turn page profiling on or off
See Troubleshooting Slow Performance Using Page Request Profiling for more information on when and how to use page profiling.
Turn detailed SQL logging on or off
See Enabling Detailed SQL Logging for more information on when and how to use detailed SQL logging.
Preset logging configurations
Confluence provides two preset log configurations:
- Production
This is the recommended default configuration, which aims to provide the most important information without flooding your logs. - Diagnostic
This changes the logging level of most packages to debug. It can be useful when troubleshooting, but results in slower performance and will fill up your log files more quickly.
If you want to reset your logging configuration to the default, select Production.
Screenshot: Changing Log Levels and Profiling
Permanently change logging level in the properties file
You need access to the installation directory to do this.
The log4j.properties
file lists all the default classes and packages, plus some additional packages that you can choose to enable.
To permanently change the logging level of a class or package:
- Stop Confluence.
- Edit the
<CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/log4j.properties
file. - Under Logging Levels, locate the package you want to change. Remove the # symbol to uncomment the package if necessary.
Change the logging level to DEBUG, INFO, WARNING, ERROR, or FATAL. See log4j Logging Levels for accepted values. For example:
log4j.logger.com.atlassian.confluence.cache=DEBUG
- Save the file, and restart Confluence for the changes to take effect.
If you're running Confluence in a cluster, you will need to repeat your change on every node. You can take each node down one by one, there's no need to stop the whole cluster.
If you want to log a class or package that's not already listed, simply add it to the file. See the log4j documentation for more information.
If you want to change the location, number, or size of the logs, see Working with Confluence Logs.
Configuring Levels for java.util.logging in logging.properties
A few libraries used by Confluence use java.util.logging rather than log4j or slf4j. These libraries include:
- com.sun.jersey
- org.apache.shindig
Confluence's logging.properties
file is set to redirect java.util.logging at specific levels to log4j via slf4j.
To increase logging levels for these libraries you must first configure the logging.properties
file in <CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/
. The logging levels are different from log4j. See java.util.logging in the Java 11 documentation.
For example, to increase logging for shindig change the following line in the logging.properties
file:
org.apache.shindig.level = INFO
to
org.apache.shindig.level = FINE
And then use one of the methods above as well to configure the log4j level.
Configure burst limiting for loggers
Confluence allows burst limiting on loggers by using the log4j2 BurstFilter implementation. Learn more about BurstFilter
To add burst limiting to a specific logger:
- Stop Confluence.
- Edit the
<CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/log4j.properties
file. Configure the file by attaching the burstFilterAppender to the desired logger. For example:
log4j.logger.com.atlassian.analytics.client.listener.ProductEventListener=WARN, burstFilterAppender log4j.additivity.com.atlassian.analytics.client.listener.ProductEventListener=false
- To configure the burst limit filter settings, create a new appender with an attached filter like the example below, and enter your desired settings where:
Level
is the log level at which we filter logs; anything at or below this level will be subject to filtering.Rate
is the average number of events we allow per second.MaxBurst is the max number of events that can occur before filtering starts.
log4j.appender.burstFilterAppender=com.atlassian.confluence.logging.ConfluenceHomeLogAppender log4j.appender.burstFilterAppender.Threshold=ALL log4j.appender.burstFilterAppender.layout=com.atlassian.confluence.util.PatternLayoutWithControlCharsEscaped log4j.appender.burstFilterAppender.layout.ConversionPattern=%d %p [%t] [%c{4}] %M %m%n log4j.appender.burstFilterAppender.filter.1=com.atlassian.confluence.impl.logging.filter.BurstFilter log4j.appender.burstFilterAppender.filter.1.Level=WARN log4j.appender.burstFilterAppender.filter.1.Rate=0.5 log4j.appender.burstFilterAppender.filter.1.MaxBurst=5
- Save the file, and restart Confluence for the changes to take effect.