version 1.28.6.3, 2003/08/14 11:55:42
|
version 1.55.2.2, 2007/09/14 21:48:54
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// 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 |
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: Sushma Fernandes (Hewlett-Packard Company) |
|
// sushma_fernandes@hp.com |
|
// Modified By: Dave Rosckes (IBM) |
|
// rosckes@us.ibm.com |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <iostream> | #include <iostream> |
#include <fstream> | #include <fstream> |
#include <cstring> | #include <cstring> |
#include "Logger.h" |
#include <Pegasus/Common/Logger.h> |
#include "System.h" |
#include <Pegasus/Common/System.h> |
#include "Destroyer.h" |
#include <Pegasus/Common/FileSystem.h> |
#include <Pegasus/Common/MessageLoader.h> //l10n |
#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 |
| |
|
// 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); |
|
|
"FATAL" | "FATAL" |
}; | }; |
| |
|
|
LoggerRep* Logger::_rep = 0; | LoggerRep* Logger::_rep = 0; |
String Logger::_homeDirectory = "."; | String Logger::_homeDirectory = "."; |
| |
|
|
const Boolean Logger::_SUCCESS = 1; | const Boolean Logger::_SUCCESS = 1; |
const Boolean Logger::_FAILURE = 0; | const Boolean Logger::_FAILURE = 0; |
| |
/* _allocLogFileName. Allocates the name from a name set. |
|
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 _allocLogFileName( |
|
const String& homeDirectory, |
|
Logger::LogFileType logFileType) |
|
{ |
|
static const char* fileNames[] = | static const 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 |
if (index > Logger::NUM_LOGS) |
#endif |
index = Logger::ERROR_LOG; |
|
| |
const char* logFileName = fileNames[index]; |
/* _constructFileName prepares the absolute file name from homeDirectory |
|
and fileName. |
| |
|
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.reserveCapacity(homeDirectory.size() + 1 + strlen(logFileName)); |
result.reserveCapacity((Uint32)(homeDirectory.size() + 1 + |
|
strlen(fileName))); |
result.append(homeDirectory); | result.append(homeDirectory); |
result.append('/'); | result.append('/'); |
result.append(logFileName); |
result.append(fileName); |
return result.getCString(); | return result.getCString(); |
} | } |
| |
|
|
| |
// KS: 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)) |
//l10n |
{ |
//cerr << "Logging Disabled"; |
|
MessageLoaderParms parms("Common.Logger.LOGGING_DISABLED", | MessageLoaderParms parms("Common.Logger.LOGGING_DISABLED", |
"Logging Disabled"); | "Logging Disabled"); |
| |
cerr << MessageLoader::getMessage(parms); | cerr << MessageLoader::getMessage(parms); |
} | } |
| |
CString fileName = _allocLogFileName(homeDirectory, Logger::TRACE_LOG); |
//Filelocks are not used for VMS |
_logs[Logger::TRACE_LOG].open(fileName, ios::app); |
#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]); |
| |
fileName = _allocLogFileName(homeDirectory, Logger::STANDARD_LOG); |
_logFileNames[Logger::STANDARD_LOG] = _constructFileName(homeDirectory, |
_logs[Logger::STANDARD_LOG].open(fileName, ios::app); |
fileNames[Logger::STANDARD_LOG]); |
| |
fileName = _allocLogFileName(homeDirectory, Logger::ERROR_LOG); |
#ifndef PEGASUS_DISABLE_AUDIT_LOGGER |
_logs[Logger::ERROR_LOG].open(fileName, ios::app); |
_logFileNames[Logger::AUDIT_LOG] = _constructFileName(homeDirectory, |
|
fileNames[Logger::AUDIT_LOG]); |
|
#endif |
|
|
|
_logFileNames[Logger::ERROR_LOG] = _constructFileName(homeDirectory, |
|
fileNames[Logger::ERROR_LOG]); |
|
|
|
_logFileNames[Logger::DEBUG_LOG] = _constructFileName(homeDirectory, |
|
fileNames[Logger::DEBUG_LOG]); |
|
#else |
| |
fileName = _allocLogFileName(homeDirectory, Logger::DEBUG_LOG); |
#ifdef PEGASUS_OS_ZOS |
_logs[Logger::DEBUG_LOG].open(fileName, ios::app); |
logIdentity = strdup(System::CIMSERVER.getCString()); |
|
// If System Log is used open it |
|
System::openlog(logIdentity, LOG_PID, LOG_DAEMON); |
#endif | #endif |
| |
|
#endif |
|
|
|
} |
|
|
|
~LoggerRep() |
|
{ |
|
|
|
#ifdef PEGASUS_OS_ZOS |
|
System::closelog(); |
|
free(logIdentity); |
|
#endif |
} | } |
| |
ostream& logOf(Logger::LogFileType logFileType) |
// Actual logging is done in this routine |
|
void log(Logger::LogFileType logFileType, |
|
const String& systemId, |
|
Uint32 logLevel, |
|
const String localizedMsg) |
|
{ |
|
#if defined(PEGASUS_OS_VXWORKS) |
|
cout << "LOGGER: " << localizedMsg << endl; |
|
#endif |
|
|
|
#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] == ':') |
{ | { |
int index = int(logFileType); |
timeStamp.remove(i, 1); |
|
} |
|
} |
|
prunedLogfile.append(timeStamp); |
| |
if (index > int(Logger::ERROR_LOG)) |
// Append '.log' to the file |
index = Logger::ERROR_LOG; |
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::_putInternal( | void Logger::_putInternal( |
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
const Uint32 logComponent, // TODO: Support logComponent mask in future release |
const Uint32 logComponent, // FUTURE: Support logComponent mask |
Uint32 logLevel, | Uint32 logLevel, |
const String& formatString, | const String& formatString, |
const String& messageId, // l10n |
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, |
|
|
if (!_rep) | if (!_rep) |
_rep = new LoggerRep(_homeDirectory); | _rep = new LoggerRep(_homeDirectory); |
| |
// Get the logLevel String |
|
// This converts bitmap to string based on highest order |
|
// bit set |
|
// ATTN: KS Fix this more efficiently. |
|
static const char* svNames[] = |
|
{ |
|
"TRACE ", |
|
"INFO ", |
|
"WARNING ", |
|
"SEVERE ", |
|
"FATAL " |
|
}; |
|
// NUM_LEVELS = 5 |
|
int sizeSvNames = sizeof(svNames) / sizeof(svNames[0]) - 1; |
|
| |
// l10n start | // l10n start |
// The localized message to be sent to the system log. | // The localized message to be sent to the system log. |
|
|
} | } |
// l10n end | // l10n end |
| |
#if defined(PEGASUS_USE_SYSLOGS) |
|
|
|
// Open the syslog. |
|
// Ignore the systemId and open the log as cimserver |
|
System::openlog(systemId); |
|
|
|
// Log the message |
|
System::syslog(logLevel,(const char*)localizedMsg.getCStringUTF8()); |
|
|
|
// Close the syslog. |
|
System::closelog(); |
|
|
|
#else |
|
| |
// Prepend the systemId to the incoming message |
// Call the actual logging routine is in LoggerRep. |
String messageString(systemId); |
_rep->log(logFileType, systemId, logLevel, localizedMsg); |
messageString.append(": "); |
|
messageString.append(localizedMsg); // l10n |
|
|
|
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 "; |
|
_rep->logOf(logFileType) << System::getCurrentASCIITime() |
|
<< " " << tmp << messageString.getCStringUTF8() << endl; |
|
|
|
#endif |
|
} | } |
} | } |
| |
|
//////////////////////////////////////////////////////////////////////////////// |
|
// |
|
// Public methods start here: |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
void Logger::put( | void Logger::put( |
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
|
|
const Formatter::Arg& arg8, | const Formatter::Arg& arg8, |
const Formatter::Arg& arg9) | const Formatter::Arg& arg9) |
{ | { |
Uint32 logComponent = 0; |
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); |
|
} |
|
} |
| |
Logger::_putInternal( |
void Logger::put( |
logFileType, |
LogFileType logFileType, |
systemId, |
const String& systemId, |
logComponent, |
Uint32 logLevel, |
logLevel, |
const String& formatString, |
formatString, |
const Formatter::Arg& arg0, |
//l10n |
const Formatter::Arg& arg1, |
String::EMPTY, |
const Formatter::Arg& arg2) |
arg0, |
{ |
arg1, |
if (wouldLog(logLevel)) |
arg2, |
{ |
arg3, |
Logger::_putInternal(logFileType, systemId, 0, logLevel, |
arg4, |
formatString, String::EMPTY, arg0, arg1, arg2); |
arg5, |
} |
arg6, |
|
arg7, |
|
arg8, |
|
arg9); |
|
} | } |
| |
// l10n |
|
void Logger::put_l( | void Logger::put_l( |
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
Uint32 logLevel, | Uint32 logLevel, |
const String& messageId, // l10n |
const String& messageId, |
const String& formatString, | const String& formatString, |
const Formatter::Arg& arg0, | const Formatter::Arg& arg0, |
const Formatter::Arg& arg1, | const Formatter::Arg& arg1, |
|
|
const Formatter::Arg& arg8, | const Formatter::Arg& arg8, |
const Formatter::Arg& arg9) | const Formatter::Arg& arg9) |
{ | { |
Uint32 logComponent = 0; |
if (wouldLog(logLevel)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, 0, logLevel, |
|
formatString, messageId, arg0, arg1, arg2, arg3, arg4, arg5, |
|
arg6, arg7, arg8, arg9); |
|
} |
|
} |
| |
Logger::_putInternal( |
void Logger::put_l( |
logFileType, |
LogFileType logFileType, |
systemId, |
const String& systemId, |
logComponent, |
Uint32 logLevel, |
logLevel, |
const String& messageId, |
formatString, |
const String& formatString) |
messageId, |
{ |
arg0, |
if (wouldLog(logLevel)) |
arg1, |
{ |
arg2, |
Logger::_putInternal(logFileType, systemId, 0, logLevel, |
arg3, |
formatString, messageId); |
arg4, |
} |
arg5, |
} |
arg6, |
|
arg7, |
void Logger::put_l( |
arg8, |
LogFileType logFileType, |
arg9); |
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::put_l( |
|
LogFileType logFileType, |
|
const String& systemId, |
|
Uint32 logLevel, |
|
const String& messageId, |
|
const String& formatString, |
|
const Formatter::Arg& arg0, |
|
const Formatter::Arg& arg1) |
|
{ |
|
if (wouldLog(logLevel)) |
|
{ |
|
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( | void Logger::trace( |
|
|
const Formatter::Arg& arg8, | const Formatter::Arg& arg8, |
const Formatter::Arg& arg9) | const Formatter::Arg& arg9) |
{ | { |
Uint32 logLevel = Logger::TRACE; |
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); |
|
} |
|
} |
| |
Logger::_putInternal( |
void Logger::trace( |
logFileType, |
LogFileType logFileType, |
systemId, |
const String& systemId, |
logComponent, |
const Uint32 logComponent, |
logLevel, |
const String& formatString, |
formatString, |
const Formatter::Arg& arg0, |
// l10n |
const Formatter::Arg& arg1) |
String::EMPTY, |
{ |
arg0, |
if (wouldLog(Logger::TRACE)) |
arg1, |
{ |
arg2, |
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
arg3, |
formatString, String::EMPTY, arg0, arg1); |
arg4, |
} |
arg5, |
} |
arg6, |
|
arg7, |
void Logger::trace( |
arg8, |
LogFileType logFileType, |
arg9); |
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); |
|
} |
} | } |
| |
// l10n |
|
void Logger::trace_l( | void Logger::trace_l( |
LogFileType logFileType, | LogFileType logFileType, |
const String& systemId, | const String& systemId, |
|
|
const Formatter::Arg& arg8, | const Formatter::Arg& arg8, |
const Formatter::Arg& arg9) | const Formatter::Arg& arg9) |
{ | { |
Uint32 logLevel = Logger::TRACE; |
if (wouldLog(Logger::TRACE)) |
|
{ |
|
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
|
formatString, messageId, arg0, arg1, arg2, arg3, arg4, arg5, arg6, |
|
arg7, arg8, arg9); |
|
} |
|
} |
| |
Logger::_putInternal( |
void Logger::trace_l( |
logFileType, |
LogFileType logFileType, |
systemId, |
const String& systemId, |
logComponent, |
const Uint32 logComponent, |
logLevel, |
const String& messageId, |
formatString, |
const String& formatString) |
messageId, |
{ |
arg0, |
if (wouldLog(Logger::TRACE)) |
arg1, |
{ |
arg2, |
Logger::_putInternal(logFileType, systemId, logComponent, Logger::TRACE, |
arg3, |
formatString, messageId); |
arg4, |
} |
arg5, |
} |
arg6, |
|
arg7, |
void Logger::trace_l( |
arg8, |
LogFileType logFileType, |
arg9); |
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) |
|
|
_homeDirectory = homeDirectory; | _homeDirectory = homeDirectory; |
} | } |
| |
//////////////////////////////////////////////////////////////////////////////// |
|
// Set logLevel. |
|
//////////////////////////////////////////////////////////////////////////////// |
|
void Logger::setlogLevelMask( const String logLevelList ) | void Logger::setlogLevelMask( const String logLevelList ) |
{ | { |
Uint32 position = 0; |
Uint32 logLevelType = 0; |
Uint32 logLevelType; |
|
String logLevelName = logLevelList; | String logLevelName = logLevelList; |
| |
// Check if logLevel has been specified | // Check if logLevel has been specified |
|
|
case Logger::FATAL: | case Logger::FATAL: |
_severityMask |= Logger::FATAL; | _severityMask |= Logger::FATAL; |
} | } |
|
|
|
Executor::updateLogLevel(logLevelName.getCString()); |
} | } |
else | else |
{ | { |
// Property logLevel not specified, set default value. | // Property logLevel not specified, set default value. |
_severityMask = ~Logger::TRACE; | _severityMask = ~Logger::TRACE; |
|
Executor::updateLogLevel("INFORMATION"); |
} | } |
return ; |
|
} | } |
| |
Boolean Logger::isValidlogLevel( |
Boolean Logger::isValidlogLevel(const String logLevel) |
const String logLevel) |
|
{ | { |
// Validate the logLevel and modify the logLevel argument | // Validate the logLevel and modify the logLevel argument |
// to reflect the invalid logLevel | // to reflect the invalid logLevel |
| |
Uint32 position=0; |
|
Uint32 index=0; | Uint32 index=0; |
String logLevelName = String::EMPTY; | String logLevelName = String::EMPTY; |
Boolean validlogLevel=false; | Boolean validlogLevel=false; |
Boolean retCode=true; |
|
| |
logLevelName = logLevel; | logLevelName = logLevel; |
| |
|
|
return validlogLevel; | return validlogLevel; |
} | } |
| |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |