version 1.21, 2008/12/02 09:00:53
|
version 1.25, 2012/12/13 14:38:55
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <iostream> | #include <iostream> |
#include <Pegasus/Common/Logger.h> |
|
#include <Pegasus/Common/TraceFileHandler.h> | #include <Pegasus/Common/TraceFileHandler.h> |
#include <Pegasus/Common/Mutex.h> | #include <Pegasus/Common/Mutex.h> |
| |
|
|
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
void TraceFileHandler::handleMessage( | void TraceFileHandler::handleMessage( |
const char* message, | const char* message, |
Uint32 msgLen, |
Uint32, |
const char* fmt, | const char* fmt, |
va_list argList) | va_list argList) |
{ | { |
|
|
{ | { |
// Unable to write message to file | // Unable to write message to file |
// Log message | // Log message |
Logger::put_l( |
MessageLoaderParms parm( |
Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING, |
"Common.TraceFileHandlerWindows.UNABLE_TO_WRITE_TRACE_TO_FILE", |
MessageLoaderParms( |
|
"Common.TraceFileHandlerWindows." |
|
"UNABLE_TO_WRITE_TRACE_TO_FILE", |
|
"Unable to write trace message to File $0", | "Unable to write trace message to File $0", |
_fileName)); |
_fileName); |
|
_logError(TRCFH_UNABLE_TO_WRITE_TRACE_TO_FILE,parm); |
} | } |
else | else |
{ | { |
fflush(_fileHandle); | fflush(_fileHandle); |
|
// trace message successful written, reset error log messages |
|
// thus allow writing of errors to log again |
|
_logErrorBitField = 0; |
} | } |
} | } |
else |
|
{ |
|
// Invalid file handle |
|
// Log message |
|
Logger::put_l( |
|
Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING, |
|
MessageLoaderParms( |
|
"Common.TraceFileHandlerWindows.INVALID_FILE_HANDLE", |
|
"Invalid file handle for file $0", |
|
_fileName)); |
|
} |
|
} | } |
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
|
|
// Will have to be enhanced to support synchronous write operations to | // Will have to be enhanced to support synchronous write operations to |
// the same file. | // the same file. |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
void TraceFileHandler::handleMessage(const char* message, Uint32 msgLen) |
void TraceFileHandler::handleMessage(const char* message, Uint32) |
{ | { |
Uint32 retCode; | Uint32 retCode; |
| |
|
|
{ | { |
// Unable to write message to file | // Unable to write message to file |
// Log message | // Log message |
Logger::put_l( |
MessageLoaderParms parm( |
Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING, |
"Common.TraceFileHandlerWindows.UNABLE_TO_WRITE_TRACE_TO_FILE", |
MessageLoaderParms( |
|
"Common.TraceFileHandlerWindows." |
|
"UNABLE_TO_WRITE_TRACE_TO_FILE", |
|
"Unable to write trace message to File $0", | "Unable to write trace message to File $0", |
_fileName)); |
_fileName); |
|
_logError(TRCFH_UNABLE_TO_WRITE_TRACE_TO_FILE,parm); |
} | } |
else | else |
{ | { |
fflush(_fileHandle); | fflush(_fileHandle); |
|
// trace message successful written, reset error log messages |
|
// thus allow writing of errors to log again |
|
_logErrorBitField = 0; |
} | } |
} | } |
else |
|
{ |
|
// Invalid file handle |
|
// Log message |
|
Logger::put_l( |
|
Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING, |
|
MessageLoaderParms( |
|
"Common.TraceFileHandlerWindows.INVALID_FILE_HANDLE", |
|
"Invalid file handle for file $0", |
|
_fileName)); |
|
} |
|
} | } |
| |
| |