]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/STEERBase/AliLog.cxx
Merge branch 'master' of http://git.cern.ch/pub/AliRoot
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliLog.cxx
index 5258eb8d0428302ad60842e9408dc455978b0a18..af92d3dce88b1b1c2a10c339e24d29c72db292ee 100644 (file)
 
 #include "AliLog.h"
 
+using std::endl;
+using std::cout;
+using std::ostream;
+using std::cerr;
+using std::ofstream;
+using std::ios;
 ClassImp(AliLog)
 
 // implementation of a singleton here
@@ -976,13 +982,13 @@ Int_t AliLog::RedirectTo(FILE* stream, EType_t type, UInt_t level,
   // redirect stream
   if ((type == kDebug) && (level > 0)) level--;
   if (type + level > GetLogLevel(module, className)) { // /dev/null
-    freopen("/dev/null", "a", stream);
+    if(!freopen("/dev/null", "a", stream)) AliWarning("Cannot reopen /dev/null");
   } else if (fOutputTypes[type] == 0) {         // stdout
     if (stream != stdout) dup2(fileno(stdout), fileno(stream));
   } else if (fOutputTypes[type] == 1) {         // stderr
     if (stream != stderr) dup2(fileno(stderr), fileno(stream));
   } else if (fOutputTypes[type] == 2) {         // file
-    freopen(fFileNames[type], "a", stream);
+    if(!freopen(fFileNames[type], "a", stream)) AliWarning(Form("Cannot reopen %s",fFileNames[type].Data()));
   } else if (fOutputTypes[type] == 3) {         // external C++ stream
     // redirection is not possible for external C++ streams
   }