From ad1bb927f1652d51900762f8fe8d01d1af49a24f Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Wed, 11 Nov 2015 18:01:24 +0100 Subject: [PATCH] Add logging for XNAT python script execution. --- grails-app/controllers/ImportXnatController.groovy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/grails-app/controllers/ImportXnatController.groovy b/grails-app/controllers/ImportXnatController.groovy index 52c7f21..baa8364 100644 --- a/grails-app/controllers/ImportXnatController.groovy +++ b/grails-app/controllers/ImportXnatController.groovy @@ -1,4 +1,3 @@ -import org.springframework.util.StringUtils import org.transmart.searchapp.ImportXnatConfiguration; import org.transmart.searchapp.ImportXnatVariable; import groovy.xml.MarkupBuilder @@ -8,7 +7,6 @@ import groovy.xml.MarkupBuilder */ class ImportXnatController { - def springSecurityService def grailsApplication // the delete, save and update actions only accept POST requests @@ -176,13 +174,20 @@ class ImportXnatController { def kettledir = (getScriptsLocation() + "/xnattotransmartlink/") def datadir = (getScriptsLocation() + "/xnattotransmartlink/") - def process = ("python " + getScriptsLocation() + "/xnattotransmartlink/downloadscript.py ${url} ${username} ${password} ${project} ${node} ${kettledir} ${datadir}").execute(null, new File(getScriptsLocation() + "/xnattotransmartlink")) + def cmd = "python " + + getScriptsLocation() + + "/xnattotransmartlink/downloadscript.py" + + " ${url} ${username} ${password} ${project} ${node} ${kettledir} ${datadir}" + log.debug(cmd) + def process = (cmd).execute(null, new File(getScriptsLocation() + "/xnattotransmartlink")) process.waitFor() def inText = process.in.text def errText = process.err.text if (errText) { + log.error(errText) flash.message = "${errText}
${inText}" } else { + log.info(inText) flash.message = inText } redirect action: import_wizard, id: importXnatConfiguration.id