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)
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.