Salome HOME
Add very simple log system
[tools/libbatch.git] / src / SGE / BatchManager_SGE.cxx
index 72d8b3cd644f8baa1aadcc02fd4f57bf6f8f44cb..ac4bea76747fb68561005c447fed3d63af8bcb49 100644 (file)
@@ -51,6 +51,7 @@
 
 #include "BatchManager_SGE.hxx"
 #include "JobInfo_SGE.hxx"
+#include "Log.hxx"
 
 using namespace std;
 
@@ -90,12 +91,12 @@ namespace Batch {
     string subCommand = string("bash -l -c \\\"cd ") + workDir + "; qsub " + fileNameToExecute + "_Batch.sh\\\"";
     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);
 
     // find id of submitted job in output
@@ -119,12 +120,12 @@ namespace Batch {
     // define command to delete batch
     string subCommand = string("bash -l -c \\\"qdel ") + iss.str() + string("\\\"");
     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
@@ -137,7 +138,7 @@ namespace Batch {
     // define command to query batch
     string subCommand = string("bash -l -c \\\"qstat | grep ") + iss.str() + string("\\\"");
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     string output;
     int status = Utils::getCommandOutput(command, output);
@@ -158,7 +159,7 @@ namespace Batch {
   {
 #ifndef WIN32
     //TODO porting on Win32 platform
-    std::cerr << "BuildBatchScript" << std::endl;
+    LOG("BuildBatchScript");
     Parametre params = job.getParametre();
 
     // Job Parameters
@@ -219,7 +220,7 @@ namespace Batch {
     tempOutputFile.close();
 
     Utils::chmod(TmpFileName.c_str(), 0x1ED);
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+    LOG("Batch script file generated is: " << TmpFileName.c_str());
 
     int status = _protocol.copyFile(TmpFileName, "", "",
                                     workDir + "/" + rootNameToExecute + "_Batch.sh",