Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

CopyProject Log problem

Agustin G_ Leguizamón Pondal December 20, 2019

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

Thread 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?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 12, 2020

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.

TAGS
AUG Leaders

Atlassian Community Events