Logging and profiling

Logging

Jira uses a powerful logging module called Log4j 2 for runtime logging.

For all of the following procedures, you must be logged in as a user with the Jira system administrator global permissions.

On this page:

Log file location

The logs are written to the log subdirectory of your Jira application home directory (or elsewhere if you have configured a different location). You can view the location of the atlassian-jira.log in the 'File Paths' section of the system information page.
  • Security-related information (e.g. login, logout, session creation/destruction, security denials) is written to atlassian-jira-security.log.

Changing the location of the log

In the log4j2.xml file (located in the Jira application installation directory), change the following section from this:

<JiraHomeAppender name="filelog"
                  fileName="atlassian-jira.log"
                  filePattern="atlassian-jira.log.%i">
    <PatternLayout alwaysWriteExceptions="false">
        <Pattern>${StackTraceFilteringPattern}</Pattern>
    </PatternLayout>
    <Policies>
        <SizeBasedTriggeringPolicy size="20480 KB"/>
    </Policies>
    <DefaultRolloverStrategy fileIndex="min" max="10"/>
</JiraHomeAppender>

... to this (replacing <LOG_PATH> with your preferred locations) :

<RollingFile name="filelog"
                  fileName="<YOUR LOGFILE PATH>"
                  filePattern="<YOUR LOGFILE PATH>.%i">
    <PatternLayout alwaysWriteExceptions="false">
      <Pattern>${StackTraceFilteringPattern}</Pattern>
    </PatternLayout>
    <Policies>
        <SizeBasedTriggeringPolicy size="20480 KB"/>
    </Policies>
    <DefaultRolloverStrategy fileIndex="min" max="10"/>
</RollingFile>

If you want to make additional changes to the appender configuration, see Log4j — Log4j 2 Appenders.

If you change the location of your log files, they will no longer be included when you generate a support zip. This means you'll need to attach your logs to any support requests manually.

Logging levels

There are five logging levels available in log4j: 'DEBUG', 'INFO', 'WARN', 'ERROR' and 'FATAL'. Each logging level provides more logging information that the level before it:

  • 'DEBUG'
  • 'INFO'
  • 'WARN'
  • 'ERROR'
  • 'FATAL'

'DEBUG' provides the most verbose logging and 'FATAL' provides the least verbose logging. The default level is 'WARN', meaning warnings and errors are displayed. Sometimes it is useful to adjust this level to see more detail.

The 'DEBUG' setting may cause user passwords to be logged.


The default logging levels can be changed either

  • temporarily — your change to the logging level will not persist after you next restart Jira, or
  • permanently — your change to the logging level will persist, even after you restart Jira.

For example, when troubleshooting, you might temporarily change the logging level from 'WARNING' to 'INFO' so as to get a more detailed error message or a stack trace. If you are unsure of which logging categories to adjust, the most helpful information generally comes from the Root and the com.atlassian loggers.

Temporarily changing the logging level

  1. From the top navigation bar select Administration  > System
  2. Select System support > Logging & Profiling to open the Logging page, which lists all defined log4j categories (as package names) and their current logging levels.
  3. To change logging level of a category, select linked logging level associated with the relevant package name. To turn off logging of a category, select the 'OFF' link associated with the relevant package name.

To set the logging level for another package that isn't listed, select Configure logging level for another package. That will prompt you to specify the package and logging level.

Permanently changing the logging level

  1. Edit the log4j2.xml file (located in the Jira application installation directory).
  2. Locate the section and make your changes (for example, change WARN to DEBUG):

    <Logger name="com.atlassian" level="WARN" additivity="false">   
        <AppenderRef ref="filelog"/> 
    </Logger> 

    The log42j.xml file that ships with Jira has the default logging levels specified.

    For more information about Log4j 2 (for example, how to define new logging categories), and about the format of the log4j2.xml file, see Log4j — Apache Log4j 2


  3. Restart Jira.


If your application server configures logging itself, you may need to remove the log4j.properties file. You may also need to remove the entire log4j.jar file to get logging to work.


Profiling

If you are experiencing performance issues with Jira, it is often helpful to see where the slow-downs occur. To do this you can enable profiling as described below, and then analyze the performance traces that Jira will produce for every request. Profiling traces report time spent in tenths of milliseconds. 

Profiling information is available in the atlassian-jira-profiler.log file.

An example of a profiling trace is shown below:

[Filter: profiling] Turning filter on [jira_profile=on]
[116ms] - /secure/Dashboard.jspa
  [5ms] - IssueManager.execute()
    [5ms] - IssueManager.execute()
      [5ms] - Searching Issues
  [29ms] - IssueManager.execute()
    [29ms] - IssueManager.execute()
      [29ms] - Searching Issues
        [28ms] - Lucene Query
          [23ms] - Lucene Search

Profiling can be enabled either

  • temporarily — profiling will be enabled until you next restart Jira, or
  • permanently — profiling will remain enabled, even after you restart Jira.

Temporarily enabling profiling

  1. From the top navigation bar select Administration  > System
  2. Select System support > Logging & Profiling to open the Logging page, which lists all defined log4j categories (as package names) and their current logging levels.
  3. Scroll to the 'Profiling' section at the end of the page. This section will inform you whether profiling is currently turned 'ON' or 'OFF' and will provide you with 'Disable' or 'Enable' profiling links respectively.
    • To turn Profiling 'ON', select the 'Enable profiling' link. Jira will start generating profiling traces in the atlassian-jira-profiler.log file.
    • To turn Profiling 'OFF', select the 'Disable profiling' link.

Permanently enabling profiling

  1. In your Jira installation directory, edit the atlassian-jira/WEB-INF/web.xml file.
  2. Find the following entry:

            <filter>
                <filter-name>profiling</filter-name>
                <filter-class>com.atlassian.jira.web.filters.JIRAProfilingFilter</filter-class>
                <init-param>
                    <!-- specify the which HTTP parameter to use to turn the filter on or off -->
                    <!-- if not specified - defaults to "profile.filter" -->
                    <param-name>activate.param</param-name>
                    <param-value>jira_profile</param-value>
                </init-param>
                <init-param>
                    <!-- specify the whether to start the filter automatically -->
                    <!-- if not specified - defaults to "false" -->
                    <param-name>autostart</param-name>
                    <param-value>false</param-value>
                </init-param>
            </filter>
    
  3. Modify the autostart parameter to be true instead of false.That is:

                <init-param>
                    <!-- specify the whether to start the filter automatically -->
                    <!-- if not specified - defaults to "false" -->
                    <param-name>autostart</param-name>
                    <param-value>true</param-value>
                </init-param>
    
  4. Save the file. Profiling will be enabled when you restart Jira and you will be able to find the profiling information in the atlassian-jira-profiler.log file.
Last modified on Jan 4, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.