(file) Return to Logger.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Logger.cpp between version 1.21 and 1.22

version 1.21, 2002/08/28 17:05:55 version 1.22, 2002/08/29 00:27:52
Line 66 
Line 66 
     mask for level of severity are all driven from configuration     mask for level of severity are all driven from configuration
     input.     input.
 */ */
 static char* _allocLogFileName(  static CString _allocLogFileName(
     const String& homeDirectory,     const String& homeDirectory,
     Logger::LogFileType logFileType)     Logger::LogFileType logFileType)
 { {
Line 90 
Line 90 
     result.append(homeDirectory);     result.append(homeDirectory);
     result.append('/');     result.append('/');
     result.append(logFileName);     result.append(logFileName);
     return result.allocateCString();      return result.getCString();
 } }
  
 class LoggerRep class LoggerRep
Line 103 
Line 103 
         // Add test for home directory set.         // Add test for home directory set.
  
         // If home directory does not exist, create it.         // If home directory does not exist, create it.
         char* lgDir = homeDirectory.allocateCString();          CString lgDir = homeDirectory.getCString();
  
         if (!System::isDirectory(lgDir))         if (!System::isDirectory(lgDir))
             System::makeDirectory(lgDir);             System::makeDirectory(lgDir);
Line 112 
Line 112 
         // a completly erronous directory.  At least we will get a message         // a completly erronous directory.  At least we will get a message
         if (!System::isDirectory(lgDir))         if (!System::isDirectory(lgDir))
             cerr << "Logging Disabled";             cerr << "Logging Disabled";
         delete [] lgDir;  
  
           CString fileName = _allocLogFileName(homeDirectory, Logger::TRACE_LOG);
         char* fileName = _allocLogFileName(homeDirectory, Logger::TRACE_LOG);  
         _logs[Logger::TRACE_LOG].open(fileName, ios::app);         _logs[Logger::TRACE_LOG].open(fileName, ios::app);
         delete [] fileName;  
  
         fileName = _allocLogFileName(homeDirectory, Logger::STANDARD_LOG);         fileName = _allocLogFileName(homeDirectory, Logger::STANDARD_LOG);
         _logs[Logger::STANDARD_LOG].open(fileName, ios::app);         _logs[Logger::STANDARD_LOG].open(fileName, ios::app);
         delete [] fileName;  
  
         fileName = _allocLogFileName(homeDirectory, Logger::ERROR_LOG);         fileName = _allocLogFileName(homeDirectory, Logger::ERROR_LOG);
         _logs[Logger::ERROR_LOG].open(fileName, ios::app);         _logs[Logger::ERROR_LOG].open(fileName, ios::app);
         delete [] fileName;  
  
         fileName = _allocLogFileName(homeDirectory, Logger::DEBUG_LOG);         fileName = _allocLogFileName(homeDirectory, Logger::DEBUG_LOG);
         _logs[Logger::DEBUG_LOG].open(fileName, ios::app);         _logs[Logger::DEBUG_LOG].open(fileName, ios::app);
         delete [] fileName;  
 #endif #endif
  
     }     }
Line 189 
Line 183 
  
         String logMsg = Formatter::format(formatString,         String logMsg = Formatter::format(formatString,
                 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);                 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
         ArrayDestroyer<char> logMsgCString(logMsg.allocateCString());  
  
         #ifdef PEGASUS_OS_HPUX         #ifdef PEGASUS_OS_HPUX
             // FUTURE-SF-P3-20020517 : Use the Syslog on HP-UX. Eventually only             // FUTURE-SF-P3-20020517 : Use the Syslog on HP-UX. Eventually only
Line 209 
Line 202 
             openlog("cimserver", LOG_PID|LOG_CONS, LOG_DAEMON);             openlog("cimserver", LOG_PID|LOG_CONS, LOG_DAEMON);
  
             // Log the message             // Log the message
             syslog(syslogLevel, "%s", logMsgCString.getPointer());              syslog(syslogLevel, "%s", (const char*)logMsg.getCString());
  
             // Close the syslog.             // Close the syslog.
             closelog();             closelog();
Line 221 
Line 214 
             if (severity & Logger::SEVERE) tmp =      "SEVERE  ";             if (severity & Logger::SEVERE) tmp =      "SEVERE  ";
             if (severity & Logger::FATAL) tmp =       "FATAL   ";             if (severity & Logger::FATAL) tmp =       "FATAL   ";
                 _rep->logOf(logFileType) << System::getCurrentASCIITime()                 _rep->logOf(logFileType) << System::getCurrentASCIITime()
                  << " " << tmp << logMsgCString.getPointer() << endl;                   << " " << tmp << logMsg << endl;
        #endif        #endif
  
     }     }
Line 231 
Line 224 
 { {
     //String logFiles = logsDirectory;     //String logFiles = logsDirectory;
     //logFiles.append("/PegasusTrace.log");     //logFiles.append("/PegasusTrace.log");
     //char* lgFiles = logFiles.allocateCString();  
     //cout << "Delete logs in " << logFiles << endl;     //cout << "Delete logs in " << logFiles << endl;
     //System::removeFile(lgFiles);      //System::removeFile(logFiles.getCString());
     //delete [] lgFiles;  
     //for (i = xx; i < yy; i++)     //for (i = xx; i < yy; i++)
     //(     //(
     //_allocateLogFileName(directory, i)     //_allocateLogFileName(directory, i)


Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2