Add Entry to the Audit Log


I am struggling a little bit with the Audit Log. I am trying to add an event to the Audit Log but I do not know which interface to use.

This is what I got so far:

private static AuditManager auditManager;
    private static AuditRecordEntityFactory auditRecordEntityFactory;

     * Which manager, etc. could I use?
     * @return 
    public static AuditManager getAuditManager() {
        //new DefaultAuditManager(auditRecordDao) how would I get this?
        if (auditManager == null) {
            auditManager = (AuditManager) ContainerManager.getComponent("auditManager");
        return auditManager;

    public static AuditRecordEntityFactory getAuditRecordEntityFactory() {
        if (auditRecordEntityFactory == null) {
            auditRecordEntityFactory = new AuditRecordEntityFactory(new DefaultI18NBeanFactory(), new DefaultLocaleManager());
        return auditRecordEntityFactory;

    public static void logClone(String name, String url) {     
        AuditRecord a = AuditRecord.builder().category("MyPlugin").affectedObject(AffectedObject.builder().objectType("object1").name(name).build()).changedValue(ChangedValue.builder().name("CLONE").build()).description("description").build();

Any help would be greatly appreciated.

Hi Dominik,
you could use AuditService instead of AuditManager:

import com.atlassian.confluence.api.service.audit.AuditService;

public class MyAuditRecorder {

	private final AuditService auditService;

	public MyAuditRecorder(final AuditService auditService) {
		this.auditService = auditService;

	public void store(...) {
		AuditRecord record = new AuditRecord.Builder();

Worked at least well for us :slight_smile:
All best


Thanks, got it working now :wink:

How do you pass the author? The type seems to be different from i.e. SAL API, it’s of type KnownUser which seems needs to be created with the KnownUser.Builder.

Would appreciate to hear how you did this.