Introduction

Sometimes you need to have a closer look at synchronization scripts to find out whats wrong. This article shows how to investigate the Exalate errors.

There are two ways to get the feedback from the Exalate app:

  • Exalate logging: it doesn't block the synchronization and requires the processor changes to run again.
  • Debugging error from the scripts - blocks the issue synchronization and requires Resolve and retry to run again.

Exalate logging

  1. Set up Exalate logging in your Jira 
  2. Add the code below into the Incoming sync Create/Change Processor

    log.info("Here's what `replica.customFields."Incident Type".value` = "+ replica.customFields."Incident Type".value)
    log.info("Here's what my issue type should be = "+ replica.customFields."Incident Type".value == "Feature Request" ? "Story" : "Bug")
    log.info("Here's what my `issue.typeName` is set = "+ issue.typeName)

  3. Exalate an issue which is not synchronized yet. In this case, it should execute the Create/Change Processor on the Destination Instance.
  4. Look at the logging and compare it with your expectations
  5. Unexalate the issue
  6. Add more logging/fix
  7. Repeat until the fix

Debugging errors from the scripts

To get more details about values passed in a replica you can use IssueTrackerException class. 

Below you can find some examples of the debugging scripts.

else if ( ... replica.project.key == "CBS" ... ) {
 if (issue.status.name != "Resolved") {
   if (replica.status.name == "Referred") throw new Exception("DEBUGGING: replica.project.key=`${replica.project.key}` issue.status.name=`${issue.status.name}` replica.customFields.\"Referral team\"?.value?.value=`${replica.customFields.\"Referral team\"?.value?.value}` ".toString())
   ...
 }
}
import com.exalate.api.exception.IssueTrackerException

throw new IssueTrackerException(
   "Here's what `replica.customFields.\"Incident Type\".value` = "+ replica.customFields."Incident Type".value + "\n" +
   "Here's what my issue type should be = "+ replica.customFields."Incident Type".value == "Feature Request" ? "Story" : "Bug" + "\n" +
   "Here's what my `issue.typeName` is set = "+ issue.typeName
)

  1. Add the exception script into the Create/Change Processor

  2. Exalate an issue to see a detailed description of the error, which blocks the synchronization.
  3. Check the details and fix the script.
  4. Resolve and retry: Once you resolve the error, another synchronization attempt processes. In case you will get an error again, repeat the steps above.
  5. Once the error is resolved successfully, remove the script below from your Create/Change Processor and resolve the error.

    throw new IssueTrackerException(...)

How to get only debug logging for the scripts

If you want to debug your scripts, then capturing all com.exalate logging is too much as it also captures all transport protocol details.

You can limit the logging to different levels:

  • for only scripts logging use com.exalate.scripts
  • for information how scripts run use com.exalate.processor


For Exalate 4.2 and lower

  • for scripts and information how they run use com.exalate.processor
  • for Outgoing sync(data filter) scripts use com.exalate.processor.jira.JiraCreateReplicaProcessor
  • for Incoming sync for new issues(create processor) scripts use com.exalate.processor.jira.JiraCreateIssueProcessor
  • for Incoming sync for existing(change processor) scripts use com.exalate.processor.jira.JiraChangeIssueProcessor


You can test how logging works by adding the code, provided below. It will add 'Hello world' text to the log file.

//add a 'Hello world' to the logging
log.info("Hello world ...") 
 


See Also

How to enable temporarily debug logging

How to enable debug logging permanently