You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
Im currently working with this code to copy my projects. It does work, but I can't get any log error/info/warn at all:
import com.onresolve.scriptrunner.canned.jira.admin.CopyProject
import com.atlassian.jira.component.ComponentAccessorThread executorThread = new Thread(new Runnable() {
void run() {
def copyProject = new CopyProject()
def inputs = [
(CopyProject.FIELD_SOURCE_PROJECT) : "TPI",
(CopyProject.FIELD_TARGET_PROJECT) : "TEST",
(CopyProject.FIELD_TARGET_PROJECT_NAME) : "TST",
(CopyProject.FIELD_COPY_ISSUES) : true,
(CopyProject.FIELD_COPY_VERSIONS) : true,
(CopyProject.FIELD_COPY_COMPONENTS) : true,
(CopyProject.FIELD_COPY_DASH_AND_FILTERS) : false
]
def errorCollection = copyProject.doValidate(inputs, false)
if(errorCollection.hasAnyErrors()) {
log.error("Couldn't create project: $errorCollection")
}
else {
def util = ComponentAccessor.getUserUtil()
def adminsGroup = util.getGroupObject("jira-administrators")
assert adminsGroup // must have jira-administrators group defined
def admins = util.getAllUsersInGroups([adminsGroup])
assert admins // must have at least one admin
ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(util.getUserByName(admins.first().name))
copyProject.doScript(inputs)
log.warn('Project TEST created')
}
}
})executorThread.start()
I did installed a fresh 7.12.3 instance, and tried in other instances. All are having the same behaviour.
Have you ever encounter with something like this?
Thank you!
Hi @Agustin G_ Leguizamón Pondal ,
but I can't get any log error/info/warn at all:
Try to import the library of the debugger at the top of the script.
import org.apache.log4j.Logger
import org.apache.log4j.Level
def log = Logger.getLogger("com.YourScript")
log.setLevel(Level.DEBUG)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.