add logger

This commit is contained in:
xiaoran 2013-11-07 16:41:25 +08:00
parent 79010d1a1e
commit ba51cd979a
1 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import java.util.List;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.OperateScriptServerResponseModel;
import org.bench4q.master.entity.db.Port;
import org.bench4q.master.entity.db.Script;
@ -30,6 +31,7 @@ public class ScriptController extends BaseController {
private ScriptService scriptService;
private PortPoolService portPoolService = new PortPoolService();
private static final Object PORT_LOCK = new Object();
private Logger logger = Logger.getLogger(ScriptController.class);
public ScriptCapturer getScriptCapturer() {
return scriptCapturer;
@ -144,10 +146,11 @@ public class ScriptController extends BaseController {
null, fileNameUUID);
}
try {
String content = FileUtils.readFileToString(file);
logger.info("when saveToDB, scriptContent is " + content);
return buildReponseModel(
this.getScriptService().saveScriptToDB(scriptName,
this.getPrincipal().getId(),
FileUtils.readFileToString(file)),
this.getPrincipal().getId(), content),
"Save to DataBase!!", "", port, null, null, null);
} catch (Exception e) {
return buildReponseModel(false, "exception when read from file",