This page last changed on Jun 11, 2008 by smaddox.

Confluence uses Apache's log4j logging service. This allows a developer or administrator to control the logging behavior and the log output file by editing a configuration file, without touching the application binary. There are six known log4j logging levels.

On this page:

Error formatting macro: toc: java.lang.NullPointerException

Finding the Log Configuration File

Confluence's logging behaviour is defined in the following properties file:
<CONFLUENCE-INSTALL>/confluence/WEB-INF/classes/log4j.properties

This file is a standard log4j configuration file, as described in the Apache log4j documentation.

Finding the Confluence Log Files

This section describes Confluence's default logging behaviour, assuming that you have not changed the destination of the logs.

For Confluence 2.6.x and earlier, the default behaviour is:

  • For Confluence Standalone, log entries are written to <confluence_install>/logs. The main log file is called atlassian-confluence.log.
  • For Confluence EAR/WAR, log entries are written to the application server logs, i.e. the default log files of the application container.

For Confluence 2.7.x and later, both Standalone and EAR/WAR editions follow the same default behaviour:

  • When you start Confluence, log entries will be sent to the application server logs until Confluence has completed its initial bootstrap. Any log entries written to the console will be repeated into the <confluence-home> log described below.
  • Once the initial startup sequence is complete, all logging will be to <confluence-home>/logs/atlassian-confluence.log. For example: c:/confluence/data/logs/atlassian-confluence.log.
    Note that the default location is now the Confluence home directory instead of the application server's log file.

Changing the Destination of the Log Files

Terminology: In log4j, an output destination is called an 'appender'.

To change the destination of the log files, you need to stop Confluence and then change the settings in the 'Logging Location and Appender' section of the log4j.properties file. The location of this file is described above.

In the standard properties file supplied with Confluence 2.7 and later, you will find entries for two appenders:

  • com.atlassian.confluence.logging.ConfluenceHomeLogAppender – This is a custom appender which controls the default logging destination described above. This appender allows the following settings:
    • MaxFileSize
    • MaxBackupIndex
  • org.apache.log4j.RollingFileAppender – If you want to log to a different location, uncomment the RollingFileAppender line and change the destination file in the line below it. Comment out the previous lines referring to the ConfluenceHomeLogAppender.

Confluence ships with the full suite of appenders offered by log4j. Read more about appenders in the log4j documentation.

Changing the Logging Levels

We recommend that you configure Confluence's logging to your own requirements. You can change the log settings in two ways:

  • Edit the properties file – Your changes will take effect next time you start Confluence, and for all subsequent sessions.
  • Set the logging levels at runtime – Your changes will be in effect only until you next restart Confluence.

Both methods are described below.

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.

Editing the Properties File

To configure the logging levels and other settings on a permanent basis, you need to stop Confluence and then change the settings in the log4j.properties file, described above.

The properties file contains a number of entries for different loggers that can be uncommented if you are interested in logging from particular components. Read more in the Apache log4j documentation.

Below are some guidelines on specific configuration options you may find useful.

Changing the Logging Levels at Runtime

From Confluence 2.7, you can change some of Confluence's logging behaviour via the Administration Console while Confluence is running. Any changes made in this way will apply only to the currently-running Confluence lifetime. The changes are not written to the log4j.properties file and are therefore discarded when you next stop Confluence.

Not all logging behaviour can be changed via the Administration Console. For logging configuration not mentioned below, you will need to stop Confluence and then edit the logging properties file instead.

The 'Logging and Profiling' screen shows a list of all currently defined loggers. On this screen you can:

  • Turn page profiling on or off.
  • Turn detailed SQL logging on or off.
  • Add a new logger for a class/package name.
  • Remove a logger for a class/package name.
  • Set the logging level (INFO, WARN, FATAL, ERROR or DEBUG) for each class or package name.
  • Reset all logging levels to a predefined profile.

To change the log levels at runtime,

  1. Go to the 'Administration Console' view. To do this:

    • Go to a page in the space and choose 'Administration' from the 'User' menu, which is labelled with your Confluence username. The 'Administration Console' view will open.
  2. Select 'Logging and Profiling' in the 'Administration' section of the left-hand panel.
    You need to have System Administrator permissions in order to perform this function.
  3. The 'Logging and Profiling' screen appears, as shown below. Use the following guidelines to change the logging behaviour while Confluence is running:
    • 'Performance Profiling' — See Page Request Profiling.
    • 'SQL Logging' — Click the 'Enable SQL Logging' button to log the details of SQL requests made to the database.
      If you need to enable logging of SQL parameter values, you will need to change the setting in the properties file. This option is not available via the Administration Console.
    • 'Log4j Logging' — Click one of the profile buttons to reset all your loggers to the predefined profiles:
      • The 'Production' profile is a fairly standard profile, recommended for normal production conditions.
      • The 'Diagnostic' profile gives more information, useful for troubleshooting and debugging. It results in slower performance and fills the log files more quickly.
    • 'Add New Entry' — Type a class or package name into the text box and click the 'Add Entry' button. The new logger will appear in the list of 'Existing Levels' in the lower part of the screen.
    • 'Existing Levels' - These are the loggers currently in action for your Confluence instance.
      • You can change the logging level by selecting a value from the 'New Level' dropdown list. Read the Apache documentation for a definition of each level.
      • Click the 'Remove' link to stop logging for the selected class/package name.
  4. Click the 'Save' button to save any changes you have made in the 'Existing Levels' section.



Screenshot: Changing Log Levels and Profiling

Using Some Specific Confluence Logging Options

This section contains some pointers to specific log configurations you may need.

Log the Details of SQL Requests made to the Database

You may want to increase Confluence's logging so that it records individual SQL requests sent to the database. This is useful for troubleshooting specific problems.

You can enable detailed SQL logging in two ways:

Log the Details of Users Viewing/Accessing each Confluence Page

You can configure the log to show which users are accessing which pages in Confluence. This can only be done via the logging properties file – see the detailed instructions.

RELATED TOPICS

LogLevels.png (image/png)
Document generated by Confluence on Jun 24, 2008 18:02