It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Logging with ScriptRunner script in Automation for Jira

Hi there,

 

I am using 'Automation for Jira' to create some rules. In one of those rules I will have to run a ScriptRunner script as an action. My question now is if there is any possibility to make use of a logging functionality.

I know that Automation for Jira allows to use smart values in combination with the mustache framework to write something into the Audit Log.

But I am doing some calculations inside the script and need to know if everything is going fine. I even tried to use 'log.debug(...)' but it didn't appear in the Audit Logs of this rule.

Are there any solutions to this problem?

 

Best regards, 

Basit

4 answers

0 votes
Jerzy Rud I'm New Here Sep 23, 2019

Same problem here. Product is very unstable.

Jack Community Leader Sep 23, 2019

Which product is unstable? If you are seeing an issue you should file a support request. I use A4J in cloud and while there are certainly some areas for improvement I have not found it to be unstable.

Like John McKiernan likes this
0 votes
Jack Community Leader Sep 23, 2019

There isn’t any integration between A4J and SR. I wish their was. You might contact Codebarrel and inquire.

Hi Jack,

well you can use ScriptRunner as an action but unfortunately it is not possible to use its full potential.

Hi Basit, 

I suppose you use something like the example in the documentation - https://scriptrunner.adaptavist.com/latest/jira/plugins/automation-for-jira.html

So if you use - in the script runner script - 

log.debug "This is a debug message"

Then you should be able to find this message in your application logs. But in order to be able to see debug messages you should first have to set the log level to debug for the ScriptRunner plugin.

Hi Thanos,

thanks for your reply. Actually this setting is already in place for our Jira and I am able to see the logs in the application log file. However, it is better for our case that these logs should also appear in the "Audit Log" that is provided within the Automation for Jira add-on. Otherwise everyone who will create or modify some rules will need access to our server with the Jira installation even though the web frontend could be enough... Hope you understand this dilemma :)

Hi Basit

Ok I see what you mean

 

Otherwise everyone who will create or modify some rules will need access to our server with the Jira installation even though the web frontend could be enough

Actually this was out thought and motivation behind View Server Log Files

If Automation tho has a kind of public API that allows you to write to Automation's Audit Log then you could use this as well. 

PS. Even tho I believe debug messages belong to application logs and not Audit logs.

Regards, Thanos

Hi Thanos,

Actually this was out thought and motivation behind View Server Log Files

This is a good idea. I also thought of this workaround. But it would make me really happy for the future if it was possible to filter certain keywords in the log. Some kind of a 'grep' functionality you know?:)

Hey Basit,

John from Automation for Jira here. I think this would be a question for the Adaptavist support team.

As you mentioned, you can debug smart values (and anything else) with Automation for Jira: https://docs.automationforjira.com/getting-started/debug-a-rule.html#_2-debugging-smart-values

From this post, it seems like it is possible to debug scripts with Scriptrunner: https://www.adaptavist.com/doco/display/SFJ/Set+logging+to+help+debug+your+scripts

Lastly, thanks for answering the initial question @Jack. Just to clarify - there is an integration with Scriptrunner and Automation for Jira - but only for Server right now. (Just noticed Thanos also pointed this out above!)

https://scriptrunner.adaptavist.com/latest/jira/plugins/automation-for-jira.html

Hope that helps,

John 

Hi John,

thanks for your answer. Debugging scripts with ScriptRunner already works for us. The thing is I would like to have these debug messages to be visible in the "Audit Log" that is provided with Automation for Jira. 

But I think you are right and this is a question for the Adaptavist team.:)

Like John McKiernan likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

314 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you