Hi there!
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?
Try to force the log level:
import org.apache.log4j.Level
log.setLevel(Level.DEBUG)
This will ensure that whatever class the logs are associated with, will be included in your logging at the desired level.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.