(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.12 and 1.55.2.4

version 1.12, 2001/07/10 06:43:27 version 1.55.2.4, 2007/11/05 01:47:23
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 20 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  
 //  
 // Modified By:  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <iostream> #include <iostream>
 #include <fstream> #include <fstream>
 #include "System.h"  #include <cstring>
 #include "Logger.h"  #include <Pegasus/Common/Logger.h>
 #include "System.h"  #include <Pegasus/Common/System.h>
   #include <Pegasus/Common/FileSystem.h>
   #include <Pegasus/Common/MessageLoader.h>
   #include <Pegasus/Common/Executor.h>
   #include <Pegasus/Common/Mutex.h>
   
   #if defined(PEGASUS_USE_SYSLOGS)
   # include <syslog.h>
   #endif
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   // Log callback function and data.
   static Logger::LogCallback _callback;
   static void* _data;
   
   // Maximum logfile size is defined as 32 MB = 32 * 1024 * 1024
   # define PEGASUS_MAX_LOGFILE_SIZE 0X2000000
   
 const Uint32 Logger::TRACE = (1 << 0); const Uint32 Logger::TRACE = (1 << 0);
 const Uint32 Logger::INFORMATION = (1 << 1); const Uint32 Logger::INFORMATION = (1 << 1);
 const Uint32 Logger::WARNING = (1 << 2); const Uint32 Logger::WARNING = (1 << 2);
 const Uint32 Logger::SEVERE = (1 << 3); const Uint32 Logger::SEVERE = (1 << 3);
 const Uint32 Logger::FATAL = (1 << 4); const Uint32 Logger::FATAL = (1 << 4);
  
   static char const* LOGLEVEL_LIST[] =
   {
       "TRACE",
       "INFORMATION",
       "WARNING",
       "SEVERE",
       "FATAL"
   };
   
 LoggerRep* Logger::_rep = 0; LoggerRep* Logger::_rep = 0;
 String Logger::_homeDirectory = "."; String Logger::_homeDirectory = ".";
 Uint32 Logger::_severityMask = 0xFF;      // Set all on by default  
   const Uint32 Logger::_NUM_LOGLEVEL = 5;
   
   // Set separator
   const char Logger::_SEPARATOR = '@';
   
   Uint32 Logger::_severityMask;
   
 Uint32 Logger::_writeControlMask = 0xF;   // Set all on by default Uint32 Logger::_writeControlMask = 0xF;   // Set all on by default
  
 /* _allocLogFileName. Allocates the name from a name set.  // Set the return codes
     Today this is static.  However, it should be completely  const Boolean Logger::_SUCCESS = 1;
     configerable and driven from the config file so that  const Boolean Logger::_FAILURE = 0;
     Log organization and names are open.  
     ATTN: rewrite this so that names, choice to do logs and      static const char* fileNames[] =
     mask for level of severity are all driven from configuration  
     input.  
 */  
 static char* _allocLogFileName(  
     const String& homeDirectory,  
     Logger::LogFileType logFileType)  
 {  
     static char* fileNames[] =  
     {     {
         "PegasusTrace.log",         "PegasusTrace.log",
         "PegasusStandard.log",         "PegasusStandard.log",
           "PegasusAudit.log",
         "PegasusError.log",         "PegasusError.log",
         "PegasusDebug.log"         "PegasusDebug.log"
     };     };
   static const char* lockFileName =  "PegasusLog.lock";
  
     int index = int(logFileType);  #if defined(PEGASUS_OS_VXWORKS) && defined(log)
   #  undef log
   #endif
  
     if (index > Logger::NUM_LOGS)  /* _constructFileName prepares the absolute file name from homeDirectory
         index = Logger::ERROR_LOG;      and fileName.
   
     const char* logFileName = fileNames[index];  
  
       Today this is static.  However, it should be completely
       configerable and driven from the config file so that
       Log organization and names are open.
       ATTN: rewrite this so that names, choice to do logs and
       mask for level of severity are all driven from configuration
       input.
   */
   static CString _constructFileName(
       const String& homeDirectory,
       const char * fileName)
   {
     String result;     String result;
     result.reserve(homeDirectory.size() + 1 + strlen(logFileName));      result.reserveCapacity((Uint32)(homeDirectory.size() + 1 +
     result += homeDirectory;          strlen(fileName)));
     result += '/';      result.append(homeDirectory);
     result += logFileName;      result.append('/');
     return result.allocateCString();      result.append(fileName);
       return result.getCString();
 } }
  
 class LoggerRep class LoggerRep
Line 88 
Line 130 
  
     LoggerRep(const String& homeDirectory)     LoggerRep(const String& homeDirectory)
     {     {
   #if !defined(PEGASUS_USE_SYSLOGS)
         // 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);
  
         // I put the second test in just in case some trys to create          // KS: I put the second test in just in case some trys to create
         // 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))
             cout << "Logging Disabled";          {
         delete [] lgDir;              MessageLoaderParms parms("Common.Logger.LOGGING_DISABLED",
                   "Logging Disabled");
   
               cerr << MessageLoader::getMessage(parms);
           }
   
          //Filelocks are not used for VMS
   #if !defined(PEGASUS_OS_VMS)
           _loggerLockFileName = _constructFileName(homeDirectory, lockFileName);
   
           // Open and close a file to make sure that the file exists, on which
           // file lock is requested
           FILE *fileLockFilePointer;
           fileLockFilePointer = fopen(_loggerLockFileName, "a+");
           if(fileLockFilePointer)
           {
               fclose(fileLockFilePointer);
           }
   #endif
   
   
           _logFileNames[Logger::TRACE_LOG] = _constructFileName(homeDirectory,
                                                  fileNames[Logger::TRACE_LOG]);
   
           _logFileNames[Logger::STANDARD_LOG] = _constructFileName(homeDirectory,
                                                  fileNames[Logger::STANDARD_LOG]);
  
   #ifndef PEGASUS_DISABLE_AUDIT_LOGGER
           _logFileNames[Logger::AUDIT_LOG] = _constructFileName(homeDirectory,
                                                  fileNames[Logger::AUDIT_LOG]);
   #endif
  
         char* fileName = _allocLogFileName(homeDirectory, Logger::TRACE_LOG);          _logFileNames[Logger::ERROR_LOG] = _constructFileName(homeDirectory,
         _logs[Logger::TRACE_LOG].open(fileName, ios::app);                                                 fileNames[Logger::ERROR_LOG]);
         delete [] fileName;  
  
         fileName = _allocLogFileName(homeDirectory, Logger::STANDARD_LOG);          _logFileNames[Logger::DEBUG_LOG] = _constructFileName(homeDirectory,
         _logs[Logger::STANDARD_LOG].open(fileName, ios::app);                                                 fileNames[Logger::DEBUG_LOG]);
         delete [] fileName;  #else
  
         fileName = _allocLogFileName(homeDirectory, Logger::ERROR_LOG);  #ifdef PEGASUS_OS_ZOS
         _logs[Logger::ERROR_LOG].open(fileName, ios::app);         logIdentity = strdup(System::CIMSERVER.getCString());
         delete [] fileName;          // If System Log is used open it
           System::openlog(logIdentity, LOG_PID, LOG_DAEMON);
   #endif
  
         fileName = _allocLogFileName(homeDirectory, Logger::DEBUG_LOG);  #endif
         _logs[Logger::DEBUG_LOG].open(fileName, ios::app);  
         delete [] fileName;  
  
     }     }
  
     ostream& logOf(Logger::LogFileType logFileType)      ~LoggerRep()
     {     {
         int index = int(logFileType);  
  
         if (index > int(Logger::ERROR_LOG))  #ifdef PEGASUS_OS_ZOS
             index = Logger::ERROR_LOG;          System::closelog();
           free(logIdentity);
   #endif
       }
   
       // Actual logging is done in this routine
       void log(Logger::LogFileType logFileType,
           const String& systemId,
           Uint32 logLevel,
           const String localizedMsg)
       {
           // Use logging callback if installed and bypass logging logic below.
   
           if (_callback)
           {
               // Set type:
   
               int type;
   
               switch (logFileType)
               {
                   case Logger::TRACE_LOG:
                       type = 1;
                       break;
                   case Logger::STANDARD_LOG:
                       type = 2;
                       break;
                   case Logger::AUDIT_LOG:
                       type = 3;
                       break;
                   case Logger::ERROR_LOG:
                       type = 4;
                       break;
                   case Logger::DEBUG_LOG:
                       type = 5;
                       break;
                   default:
                       return;
               }
   
               // Set system:
   
               CString system(systemId.getCString());
   
               // Set level:
   
               int level;
   
               switch (logLevel)
               {
                   case Logger::TRACE:
                       level = 1;
                       break;
                   case Logger::INFORMATION:
                       level = 2;
                       break;
                   case Logger::WARNING:
                       level = 3;
                       break;
                   case Logger::SEVERE:
                       level = 4;
                       break;
                   case Logger::FATAL:
                       level = 5;
                       break;
                   default:
                       return;
               }
   
               // Set message:
   
               CString message(localizedMsg.getCString());
   
               // Invoke the callback.
   
               (*_callback)(type, system, level, message, _data);
   
               return;
           }
   
   #if defined(PEGASUS_USE_SYSLOGS)
   
           // Log the message
           System::syslog(systemId, logLevel, localizedMsg.getCString());
   
   #else
           // Prepend the systemId to the incoming message
           String messageString(systemId);
           messageString.append(": ");
           messageString.append(localizedMsg);  // l10n
   
           // Get the logLevel String
           // This converts bitmap to string based on highest order
           // bit set
           // ATTN: KS Fix this more efficiently.
           const char* tmp = "";
           if (logLevel & Logger::TRACE) tmp =       "TRACE   ";
           if (logLevel & Logger::INFORMATION) tmp = "INFO    ";
           if (logLevel & Logger::WARNING) tmp =     "WARNING ";
           if (logLevel & Logger::SEVERE) tmp =      "SEVERE  ";
           if (logLevel & Logger::FATAL) tmp =       "FATAL   ";
   
   # ifndef PEGASUS_OS_VMS
           // Acquire AutoMutex (for thread sync)
           // and AutoFileLock (for Process Sync).
           AutoMutex am(_mutex);
           AutoFileLock fileLock(_loggerLockFileName);
   
           Uint32  logFileSize = 0;
   
           // Read logFileSize to check if the logfile needs to be pruned.
           FileSystem::getFileSize(String(_logFileNames[logFileType]),
                                          logFileSize);
   
           // Check if the size of the logfile is exceeding 32MB.
           if ( logFileSize > PEGASUS_MAX_LOGFILE_SIZE)
       {
               // Prepare appropriate file name based on the logFileType.
               // Eg: if Logfile name is PegasusStandard.log, pruned logfile name
               // will be PegasusStandard-062607-122302.log,where 062607-122302
               // is the time stamp.
               String prunedLogfile(_logFileNames[logFileType],
                                   (Uint32)strlen(_logFileNames[logFileType]) - 4);
               prunedLogfile.append('-');
   
               // Get timestamp,remove illegal chars in file name'/' and ':'
               // (: is illegal Open VMS) from the time stamp. Append the time
               // info to the file name.
   
               String timeStamp = System::getCurrentASCIITime();
               for (unsigned int i=0; i<=timeStamp.size(); i++)
               {
                   if(timeStamp[i] == '/' || timeStamp[i] == ':')
                   {
                       timeStamp.remove(i, 1);
                   }
               }
               prunedLogfile.append(timeStamp);
   
               // Append '.log' to the file
               prunedLogfile.append( ".log");
  
         return _logs[index];              // Rename the logfile
               FileSystem::renameFile(String(_logFileNames[logFileType]),
                                      prunedLogfile);
   
           } // Check if the logfile needs to be pruned.
   # endif  // ifndef PEGASUS_OS_VMS
   
           // Open Logfile. Based on the value of logFileType, one of the five
           // Logfiles will be opened.
           ofstream logFileStream;
           logFileStream.open(_logFileNames[logFileType], ios::app);
           logFileStream << System::getCurrentASCIITime()
              << " " << tmp << (const char *)messageString.getCString() << endl;
           logFileStream.close();
   #endif // ifndef PEGASUS_USE_SYSLOGS
     }     }
  
 private: private:
  
     ofstream _logs[int(Logger::NUM_LOGS)];  #ifdef PEGASUS_OS_ZOS
       char* logIdentity;
   #endif
       CString _logFileNames[int(Logger::NUM_LOGS)];
   #ifndef PEGASUS_OS_VMS
       CString _loggerLockFileName;
       Mutex _mutex;
   #endif
 }; };
  
 void Logger::put(  void Logger::_putInternal(
     LogFileType logFileType,     LogFileType logFileType,
     const String& systemId,     const String& systemId,
     Uint32 severity,      const Uint32 logComponent, // FUTURE: Support logComponent mask
       Uint32 logLevel,
     const String& formatString,     const String& formatString,
       const String& messageId,
     const Formatter::Arg& arg0,     const Formatter::Arg& arg0,
     const Formatter::Arg& arg1,     const Formatter::Arg& arg1,
     const Formatter::Arg& arg2,     const Formatter::Arg& arg2,
Line 152 
Line 385 
     const Formatter::Arg& arg8,     const Formatter::Arg& arg8,
     const Formatter::Arg& arg9)     const Formatter::Arg& arg9)
 { {
     // Test for severity against severity mask to determine      // Test for logLevel against severity mask to determine
     // if we write this log.     // if we write this log.
     if ((_severityMask & severity) != 0)      if ((_severityMask & logLevel) != 0)
     {     {
         if (!_rep)         if (!_rep)
            _rep = new LoggerRep(_homeDirectory);            _rep = new LoggerRep(_homeDirectory);
  
         // Get the Severity String  
         // This converts bitmap to string based on highest order          // l10n start
         // bit set          // The localized message to be sent to the system log.
         // ATTN: KS Fix this more efficiently.          String localizedMsg;
         static char* svNames[] =  
           // If the caller specified a messageId, then load the localized
           // message in the locale of the server process.
           if (messageId != String::EMPTY)
             {             {
             "TRACE   ",              // A message ID was specified.  Use the MessageLoader.
             "INFO    ",              MessageLoaderParms msgParms(messageId, formatString);
             "WARNING ",              msgParms.useProcessLocale = true;
             "SEVERE  ",              msgParms.arg0 = arg0;
             "FATAL   "              msgParms.arg1 = arg1;
             };              msgParms.arg2 = arg2;
         // NUM_LEVELS = 5              msgParms.arg3 = arg3;
         int sizeSvNames = sizeof(svNames) / sizeof(svNames[0]) - 1;              msgParms.arg4 = arg4;
               msgParms.arg5 = arg5;
               msgParms.arg6 = arg6;
               msgParms.arg7 = arg7;
               msgParms.arg8 = arg8;
               msgParms.arg9 = arg9;
   
               localizedMsg = MessageLoader::getMessage(msgParms);
           }
           else
           {  // No message ID.  Use the Pegasus formatter
                 localizedMsg = Formatter::format(formatString,
                   arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
           }
   // l10n end
   
   
          // Call the actual logging routine is in LoggerRep.
          _rep->log(logFileType, systemId, logLevel, localizedMsg);
       }
   }
   
   ////////////////////////////////////////////////////////////////////////////////
   //
   // Public methods start here:
   //
   ////////////////////////////////////////////////////////////////////////////////
   
   void Logger::put(
       LogFileType logFileType,
       const String& systemId,
       Uint32 logLevel,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1,
       const Formatter::Arg& arg2,
       const Formatter::Arg& arg3,
       const Formatter::Arg& arg4,
       const Formatter::Arg& arg5,
       const Formatter::Arg& arg6,
       const Formatter::Arg& arg7,
       const Formatter::Arg& arg8,
       const Formatter::Arg& arg9)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, String::EMPTY, arg0, arg1, arg2, arg3,
               arg4, arg5, arg6, arg7, arg8, arg9);
       }
   }
   
   void Logger::put(
       LogFileType logFileType,
       const String& systemId,
       Uint32 logLevel,
       const String& formatString)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, String::EMPTY);
       }
   }
   
   void Logger::put(
       LogFileType logFileType,
       const String& systemId,
       Uint32 logLevel,
       const String& formatString,
       const Formatter::Arg& arg0)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, String::EMPTY, arg0);
       }
   }
   
   void Logger::put(
       LogFileType logFileType,
       const String& systemId,
       Uint32 logLevel,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, String::EMPTY, arg0, arg1);
       }
   }
   
   void Logger::put(
       LogFileType logFileType,
       const String& systemId,
       Uint32 logLevel,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1,
       const Formatter::Arg& arg2)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, String::EMPTY, arg0, arg1, arg2);
       }
   }
   
   void Logger::put_l(
       LogFileType logFileType,
       const String& systemId,
       Uint32 logLevel,
       const String& messageId,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1,
       const Formatter::Arg& arg2,
       const Formatter::Arg& arg3,
       const Formatter::Arg& arg4,
       const Formatter::Arg& arg5,
       const Formatter::Arg& arg6,
       const Formatter::Arg& arg7,
       const Formatter::Arg& arg8,
       const Formatter::Arg& arg9)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, messageId, arg0, arg1, arg2, arg3, arg4, arg5,
               arg6, arg7, arg8, arg9);
       }
   }
  
         char* tmp = "";  void Logger::put_l(
         if (severity & Logger::TRACE) tmp =       "TRACE   ";       LogFileType logFileType,
         if (severity & Logger::INFORMATION) tmp = "INFO    ";       const String& systemId,
         if (severity & Logger::WARNING) tmp =     "WARNING ";       Uint32 logLevel,
         if (severity & Logger::SEVERE) tmp =      "SEVERE  ";       const String& messageId,
         if (severity & Logger::FATAL) tmp =       "FATAL   ";       const String& formatString)
   {
        _rep->logOf(logFileType) << System::getCurrentASCIITime() << " " << tmp      if (wouldLog(logLevel))
            << Formatter::format(formatString,      {
            arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) << endl;          Logger::_putInternal(logFileType, systemId, 0, logLevel,
           formatString, messageId);
       }
   }
  
   void Logger::put_l(
        LogFileType logFileType,
        const String& systemId,
        Uint32 logLevel,
        const String& messageId,
        const String& formatString,
        const Formatter::Arg& arg0)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, messageId, arg0);
     }     }
 } }
  
 void Logger::clean(const String& directory)  void Logger::put_l(
 {       LogFileType logFileType,
     //String logFiles = logsDirectory;       const String& systemId,
     //logFiles.append("/PegasusTrace.log");       Uint32 logLevel,
     //char* lgFiles = logFiles.allocateCString();       const String& messageId,
     //cout << "Delete logs in " << logFiles << endl;       const String& formatString,
     //System::removeFile(lgFiles);       const Formatter::Arg& arg0,
     //delete [] lgFiles;       const Formatter::Arg& arg1)
     //for (i = xx; i < yy; i++)  {
     //(      if (wouldLog(logLevel))
     //_allocateLogFileName(directory, i)      {
     //removeFile(          Logger::_putInternal(logFileType, systemId, 0, logLevel,
     //}              formatString, messageId, arg0, arg1);
       }
   }
   
   void Logger::put_l(
        LogFileType logFileType,
        const String& systemId,
        Uint32 logLevel,
        const String& messageId,
        const String& formatString,
        const Formatter::Arg& arg0,
        const Formatter::Arg& arg1,
        const Formatter::Arg& arg2)
   {
       if (wouldLog(logLevel))
       {
           Logger::_putInternal(logFileType, systemId, 0, logLevel,
               formatString, messageId, arg0, arg1, arg2);
       }
   }
   
   void Logger::trace(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1,
       const Formatter::Arg& arg2,
       const Formatter::Arg& arg3,
       const Formatter::Arg& arg4,
       const Formatter::Arg& arg5,
       const Formatter::Arg& arg6,
       const Formatter::Arg& arg7,
       const Formatter::Arg& arg8,
       const Formatter::Arg& arg9)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, String::EMPTY, arg0, arg1, arg2, arg3, arg4, arg5,
               arg6, arg7, arg8, arg9);
       }
   }
   
   void Logger::trace(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& formatString)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, String::EMPTY);
       }
   }
   
   void Logger::trace(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& formatString,
       const Formatter::Arg& arg0)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, String::EMPTY, arg0);
       }
   }
   
   void Logger::trace(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, String::EMPTY, arg0, arg1);
       }
   }
   
   void Logger::trace(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1,
       const Formatter::Arg& arg2)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, String::EMPTY, arg0, arg1, arg2);
       }
   }
   
   void Logger::trace_l(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& messageId,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1,
       const Formatter::Arg& arg2,
       const Formatter::Arg& arg3,
       const Formatter::Arg& arg4,
       const Formatter::Arg& arg5,
       const Formatter::Arg& arg6,
       const Formatter::Arg& arg7,
       const Formatter::Arg& arg8,
       const Formatter::Arg& arg9)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, messageId, arg0, arg1, arg2, arg3, arg4, arg5, arg6,
               arg7, arg8, arg9);
       }
   }
   
   void Logger::trace_l(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& messageId,
       const String& formatString)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, messageId);
       }
   }
   
   void Logger::trace_l(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& messageId,
       const String& formatString,
       const Formatter::Arg& arg0)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, messageId, arg0);
       }
   }
   
   void Logger::trace_l(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& messageId,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, messageId, arg0, arg1);
       }
   }
   
   void Logger::trace_l(
       LogFileType logFileType,
       const String& systemId,
       const Uint32 logComponent,
       const String& messageId,
       const String& formatString,
       const Formatter::Arg& arg0,
       const Formatter::Arg& arg1,
       const Formatter::Arg& arg2)
   {
       if (wouldLog(Logger::TRACE))
       {
           Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE,
               formatString, messageId, arg0, arg1, arg2);
       }
 } }
  
 void Logger::setHomeDirectory(const String& homeDirectory) void Logger::setHomeDirectory(const String& homeDirectory)
Line 208 
Line 779 
     _homeDirectory = homeDirectory;     _homeDirectory = homeDirectory;
 } }
  
   void Logger::setlogLevelMask( const String logLevelList )
   {
       Uint32 logLevelType = 0;
       String logLevelName      = logLevelList;
   
       // Check if logLevel has been specified
       if (logLevelName != String::EMPTY)
       {
           // initialise _severityMask
           _severityMask = 0;
   
           // Set logLevelType to indicate the level of logging
           // required by the user.
           if (String::equalNoCase(logLevelName,"TRACE"))
           {
               logLevelType =  Logger::TRACE;
           }
           else if (String::equalNoCase(logLevelName,"INFORMATION"))
           {
               logLevelType =  Logger::INFORMATION;
           }
           else if (String::equalNoCase(logLevelName,"WARNING"))
           {
               logLevelType = Logger::WARNING;
           }
           else if (String::equalNoCase(logLevelName,"SEVERE"))
           {
               logLevelType = Logger::SEVERE;
           }
           else if (String::equalNoCase(logLevelName,"FATAL"))
           {
               logLevelType = Logger::FATAL;
           }
           // Setting _severityMask.  NOTE:  When adding new logLevels
           // it is essential that they are adding in ascending order
           // based on priority.  Once a case statement is true we will
           // continue to set all following log levels with a higher
           // priority.
           switch(logLevelType)
           {
               case Logger::TRACE:
                     _severityMask |= Logger::TRACE;
               case Logger::INFORMATION:
                     _severityMask |= Logger::INFORMATION;
               case Logger::WARNING:
                     _severityMask |= Logger::WARNING;
               case Logger::SEVERE:
                     _severityMask |= Logger::SEVERE;
               case Logger::FATAL:
                     _severityMask |= Logger::FATAL;
           }
   
           Executor::updateLogLevel(logLevelName.getCString());
       }
       else
       {
           // Property logLevel not specified, set default value.
           _severityMask = ~Logger::TRACE;
           Executor::updateLogLevel("INFORMATION");
       }
   }
   
   Boolean Logger::isValidlogLevel(const String logLevel)
   {
       // Validate the logLevel and modify the logLevel argument
       // to reflect the invalid logLevel
   
       Uint32    index=0;
       String    logLevelName = String::EMPTY;
       Boolean   validlogLevel=false;
   
       logLevelName = logLevel;
   
       if (logLevelName != String::EMPTY)
       {
           // Lookup the index for logLevel name in _logLevel_LIST
           index = 0;
           validlogLevel = false;
   
           while (index < _NUM_LOGLEVEL)
           {
               if (String::equalNoCase(logLevelName, LOGLEVEL_LIST[index]))
               {
                   // Found logLevel, break from the loop
                   validlogLevel = true;
                   break;
               }
               else
               {
                   index++;
               }
           }
       }
       else
       {
           // logLevels is empty, it is a valid value so return true
           return _SUCCESS;
       }
   
       return validlogLevel;
   }
   
   
   void Logger::setLogCallback(Logger::LogCallback callback, void* data)
   {
       _callback = callback;
       _data = data;
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.12  
changed lines
  Added in v.1.55.2.4

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2