Salome HOME
Add very simple log system
[tools/libbatch.git] / src / PBS / BatchManager_PBS.cxx
index 7dfd666d8dac6ccc7893af6a43c03f8b955b8c78..ae18c2329b96edb8d68cb64f7d415cee952ee24b 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "BatchManager_PBS.hxx"
 #include "JobInfo_PBS.hxx"
+#include "Log.hxx"
 
 using namespace std;
 
@@ -74,12 +75,12 @@ namespace Batch {
     string subCommand = string("cd ") + workDir + "; qsub " + scriptFile;
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
     command += " 2>&1";
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     // submit job
     string output;
     int status = Utils::getCommandOutput(command, output);
-    cout << output;
+    LOG(output);
     if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
 
     // normally output contains only id of submitted job, we just need to remove the final \n
@@ -100,12 +101,12 @@ namespace Batch {
     // define command to delete batch
     string subCommand = string("qdel ") + iss.str();
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
     status = system(command.c_str());
     if (status)
       throw RunTimeException("Error of connection on remote host");
 
-    cerr << "jobId = " << ref << "killed" << endl;
+    LOG("jobId = " << ref << "killed");
   }
 
   // Methode pour le controle des jobs : renvoie l'etat du job
@@ -118,7 +119,7 @@ namespace Batch {
     // define command to query batch
     string subCommand = string("qstat -f ") + iss.str();
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     string output;
     int status = Utils::getCommandOutput(command, output);
@@ -239,7 +240,7 @@ namespace Batch {
     tempOutputFile.flush();
     tempOutputFile.close();
 
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+    LOG("Batch script file generated is: " << TmpFileName.c_str());
 
     string remoteFileName = rootNameToExecute + "_Batch.sh";
     int status = _protocol.copyFile(TmpFileName, "", "",