Salome HOME
Add very simple log system
[tools/libbatch.git] / src / LoadLeveler / BatchManager_LL.cxx
index c5fe1b204a840aee3975bb8a401956603ddf592b..f62871ebcdf109ede5bccf3d6549144933abc5ee 100644 (file)
@@ -37,6 +37,7 @@
 #include "FactBatchManager_LL.hxx"
 #include "BatchManager_LL.hxx"
 #include "JobInfo_LL.hxx"
+#include "Log.hxx"
 
 using namespace std;
 
@@ -70,12 +71,12 @@ namespace Batch {
     // define command to submit batch
     string subCommand = string("cd ") + workDir + "; llsubmit " + cmdFile;
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    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
@@ -199,7 +200,7 @@ namespace Batch {
     tempOutputFile.flush();
     tempOutputFile.close();
 
-    cerr << "Batch script file generated is: " << tmpFileName << endl;
+    LOG("Batch script file generated is: " << tmpFileName);
 
     string remoteFileName = rootNameToExecute + "_LL.cmd";
     int status = _protocol.copyFile(tmpFileName, "", "",
@@ -216,13 +217,13 @@ namespace Batch {
     // define command to delete job
     string subCommand = "llcancel " + jobid.getReference();
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     int status = system(command.c_str());
     if (status)
       throw RunTimeException("Can't delete job " + jobid.getReference());
 
-    cerr << "job " << jobid.getReference() << " killed" << endl;
+    LOG("job " << jobid.getReference() << " killed");
   }
 
   JobInfo BatchManager_LL::queryJob(const JobId & jobid)
@@ -230,7 +231,7 @@ namespace Batch {
     // define command to query batch
     string subCommand = "llq -f %st " + jobid.getReference();
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
     string output;
     int status = Utils::getCommandOutput(command, output);
     if (status != 0)