Improve Audit Logs to include user, action and timestamp
π― Goal
Audit logs should clearly show:
π WHO β WHAT β WHEN
Example:
Adam - ATTACHMENT_ADDED - 2026-04-20 12:23
π Current Situation
Right now:
- Audit logging system exists (
AuditService, AuditLog, AuditAction) β
- Some actions are logged (e.g. attachments) β
- Timestamp exists in DB (
createdAt) β
- UI only shows the action β
- User (who performed the action) is NOT stored β
π This means we currently only see WHAT happened, but not WHO or WHEN (in UI).
π§© What needs to be done
1. Store WHO performed the action (Backend)
In AuditService, update the log method:
log.setUser(securityUtils.getCurrentUserOrNull());
π This ensures every audit log contains the user.
2. Add missing audit logs (Backend)
We need to log ALL important actions using:
TicketService
Add logging:
- When a ticket is assigned
- When ticket status is updated
TicketCommentService
Add logging:
- When a comment is created
AttachmentService
β Already implemented (ATTACHMENT_ADDED)
(No changes needed here)
3. Update UI (view.jte)
In the Audit Logs section, change rendering to:
@for(var log : auditLogs)
<div>
${log.getUser() != null ? log.getUser().getUsername() : "Anonymous"}
- ${log.getAction()}
- ${log.getCreatedAt()}
</div>
@endfor
π This will display:
- Username (or Anonymous)
- Action
- Timestamp
β
Expected Result
Audit logs should display:
- WHO performed the action
- WHAT action was performed
- WHEN it happened
β οΈ Important Notes
- Old logs (already in DB) will not have user β show as
"Anonymous"
- No changes needed to
AuditAction enum
- No need to rebuild the audit system β just extend it
π§ Summary
- Add user to audit logs
- Add logging in missing places
- Update UI to show full information
This will make the audit logs complete and meet the transparency requirement π
Improve Audit Logs to include user, action and timestamp
π― Goal
Audit logs should clearly show:
π WHO β WHAT β WHEN
Example:
π Current Situation
Right now:
AuditService,AuditLog,AuditAction) βcreatedAt) βπ This means we currently only see WHAT happened, but not WHO or WHEN (in UI).
π§© What needs to be done
1. Store WHO performed the action (Backend)
In
AuditService, update the log method:π This ensures every audit log contains the user.
2. Add missing audit logs (Backend)
We need to log ALL important actions using:
TicketService
Add logging:
TicketCommentService
Add logging:
AttachmentService
β Already implemented (
ATTACHMENT_ADDED)(No changes needed here)
3. Update UI (view.jte)
In the Audit Logs section, change rendering to:
π This will display:
β Expected Result
Audit logs should display:
"Anonymous"AuditActionenumπ§ Summary
This will make the audit logs complete and meet the transparency requirement π