Hi,
I try to read the Jira Audit log on Jira Server 8.13+ with ScriptRunner. But I don't know how to get the needed component AuditService.
If I run
import com.atlassian.audit.api.AuditSearchService
import com.atlassian.jira.component.ComponentAccessor
def auditSearchService = ComponentAccessor.getComponent(AuditSearchService)
if (!auditSearchService) {
log.error "No AuditSearchService found."
}
in the console, I always get the error No AuditSearchService found.
What did I miss here?
Thanks,
Henning
Hi @htietgens , you can use
import com.atlassian.audit.api.AuditSearchService
import com.atlassian.jira.component.ComponentAccessor
def auditSearchService = ComponentAccessor.getOSGiComponentInstanceOfType(AuditSearchService)
if (!auditSearchService) {
log.error "No AuditSearchService found."
}
Thanks, that works. Is there some kind of rule or similar on how to determine if I should use getComponent() or getOSGiComponentInstanceOfType()?
Best,
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @htietgens in p2 projects you can have public services (marked with @ExportAsService annotation) and these types of services can be loaded only using posted method. It is safer to use this method in all cases...briefly :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.