Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom listener is showing anything in logs when executed

Sainath Bavugi July 31, 2020

I am new to script runner and learning custom listeners. Trying this basic code to write log for all issue events under a particular project but when the script executes no logs are written.  Am I doing something wrong or checking at the wrong place for the logs?

package com.gt.jira.listeners
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import org.apache.log4j.Category

class ExampleListener extends AbstractIssueEventListener {
Category log = Category.getInstance(ExampleListener.class) @Override void workflowEvent(IssueEvent event) { log.debug "Event: ${event.getEventTypeId()} fired for ${event.issue} and caught by ExampleListener" } }

Successfully executed Annotation 2020-07-31 121606.jpg

Listener configuration.Annotation 2020-07-31 121741.jpg

1 answer

1 accepted

0 votes
Answer accepted
Martin Bayer _MoroSystems_ s_r_o__
Community Champion
July 31, 2020

 

the simpliest solution is to use log.error instead of log.debug because debug is not logged by default or you have to set to logging level...it is described here https://www.adaptavist.com/doco/plugins/servlet/mobile?contentId=11993359#content/view/11993359

Sainath Bavugi August 3, 2020

Sorry, I should have mentioned. I have tried info, warning and error but none of them are showing the output. Not sure if I am looking at the wrong place for the logs. I have checked atlassian_jira.log file as well for entires but no luck.

Martin Bayer _MoroSystems_ s_r_o__
Community Champion
August 3, 2020

@Sainath Bavugi I did some tests and you have to use fully quallified name of the class instead of "path" to your script, so replace

  • com/gt/jira/listeners/ExampleListener.groovy
  • WITH
  • com.gt.jira.listeners.ExampleListener

If you will use log.error you should see it in your log files.

Sainath Bavugi August 4, 2020

Thanks a lot, Martin. That worked for me.

Martin Bayer _MoroSystems_ s_r_o__
Community Champion
August 4, 2020

Great :), it was pleassure to help you :)

Suggest an answer

Log in or Sign up to answer