How to enable API access logging in Confluence
Purpose
API calls are not logged by default in Confluence. You might want to enable this logging to debug any REST/XML-RPC related issues you are seeing.
Solution
Notes:
- This is very similar to our documentation on how to enable user access logging. We will just make some tweaks to the URL patterns provided
- Please do not modify the application-wide web descriptor,
$server/conf/web.xml
. This will be ineffective and potentially may break Confluence.
To enable the AccessLogFilter:
Uncomment this line in
confluence/WEB-INF/classes/log4j.properties
:log4j.category.com.atlassian.confluence.util.AccessLogFilter=INFO
Enable the filter in
confluence/WEB-INF/web.xml
by removing the comments around these lines (or adding if they are not included):<filter-mapping> <filter-name>AccessLogFilter</filter-name> <url-pattern>/rest/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>AccessLogFilter</filter-name> <url-pattern>/rpc/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>AccessLogFilter</filter-name> <url-pattern>/soap/*</url-pattern> </filter-mapping>
This combination of URL patterns will work for REST, XML-RPC, and SOAP API calls. You can further modify the pattern by adjusting the
url-pattern
field if you see any other URL patterns used in API calls that are not included in the above. For example, if you only want to capture REST calls for Team Calendars only, you can filter it as follows:<filter-mapping> <filter-name>AccessLogFilter</filter-name> <url-pattern>/rest/calendar-services/*</url-pattern> </filter-mapping>