Hi, I am starting with groovy in Script Runner and a few things are unclear. Can I use this thread for further questions too?
The classes in ScriptRunner are just the original Atlassian JIRA Java classes which you can use with Groovy. So you have full access to all the methods you do on the Atlassian JIRA API. There is no special "wrapper" around them.
For example issue is just this https://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/Issue.html
For the double logging, it looks like both the root logger and the new logger you have setup are logging. In your log4j.properties can you add this to see if this solves the issue:
log4j.additivity.com.onresolve=false
I followed the tutorial for setting up the dev environment. Everytime I log.debug something I get the message twice:
2016-02-25 10:06:54,190 http-nio-8080-exec-24 DEBUG 606x4798x1 1i3lirg 127.0.0.1 /rest/api/2/issue/10000/comment [c.o.scriptrunner.runner.ScriptRunnerImpl] My instance contains 1 users
2016-02-25 10:06:54,190 http-nio-8080-exec-24 DEBUG 606x4798x1 1i3lirg 127.0.0.1 /rest/api/2/issue/10000/comment [c.o.scriptrunner.runner.ScriptRunnerImpl] My instance contains 1 users
Any Idea why?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, strange, now I don´t get debug messages at all, even after I changed it back.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I get one debug now, which is good, but if I put log.debug in a class nothing is logged. Why is that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That´s weird, I got an email, but your answer isn´t shown here.
I wrote a SendEmail class, in a send method I´ll do log.debug "something" and that debug message is not shown in the log. If I do log.debug in the class calling script I can do log.debug, but not in the imported class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc, add the following to your class:
@groovy.util.logging.Log4j class SendEmail { public void send() { log.debug("hello") } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, still nothing, here the class:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you set the logging level to debug in the script console by doing: https://scriptrunner.adaptavist.com/latest/jira/getting-help.html#_support_requests
Then run your script.
Or do log.warn instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, still no debug in classes.
Is that a one time thing or should I put it in my script too?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to change the package the script is under to "com.onresolve" or do:
@Log4j(category = "com.onresolve.somepackage") class SendEmail { public void send() { log.debug("hello") } }
Its probably easier to use a higher logging level like log.warn.
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.
To sum this up, we solved it by adding:
log4j.logger.library = DEBUG, console, filelog
log4j.additivity.library = false
to the log4j.properties file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is correct since groovy is extension for Java.
Ask further questions.
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.
Ok, next question:
The classes I fetch from ComponentAccessor, is that always a new instance or an instance that JIRA already uses at that moment?
I want to extend the CommentManager, is that doable by changing the factory or do I have to instatiate it with all it´s dependencies?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you ask a new question please, answering a question with a new question makes it hard for people to use this as a resource.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Aw, Jamie! But I love using tools where I can squish all the information is in a single long running thread. Email just roolz ;-)
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.