version 1.44, 2006/10/13 18:04:49
|
version 1.47, 2006/11/08 20:38:30
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// 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 |
|
// Amit K Arora, IBM (amita@in.ibm.com) for PEP101 |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <iostream> | #include <iostream> |
|
|
#include "System.h" | #include "System.h" |
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
| |
|
#if defined(PEGASUS_USE_SYSLOGS) |
|
# include <syslog.h> |
|
#endif |
|
|
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
{ | { |
"PegasusTrace.log", | "PegasusTrace.log", |
"PegasusStandard.log", | "PegasusStandard.log", |
|
"PegasusAudit.log", |
"PegasusError.log", | "PegasusError.log", |
"PegasusDebug.log" | "PegasusDebug.log" |
}; | }; |
|
|
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); |
| |
|
#ifndef PEGASUS_DISABLE_AUDIT_LOGGER |
|
fileName = _allocLogFileName(homeDirectory, Logger::AUDIT_LOG); |
|
_logs[Logger::AUDIT_LOG].open(fileName, ios::app); |
|
#endif |
|
|
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); |
| |
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); |
|
#else |
|
|
|
#ifdef PEGASUS_OS_ZOS |
|
logIdendity = System::CIMSERVER.getCString(); |
|
// If System Log is used open it |
|
System::openlog(logIdendity, LOG_PID, LOG_DAEMON); |
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
~LoggerRep() |
|
{ |
|
#if !defined(PEGASUS_USE_SYSLOGS) |
|
_logs[Logger::TRACE_LOG].close(); |
|
_logs[Logger::STANDARD_LOG].close(); |
|
|
|
#ifndef PEGASUS_DISABLE_AUDIT_LOGGER |
|
_logs[Logger::AUDIT_LOG].close(); |
|
#endif |
|
|
|
_logs[Logger::ERROR_LOG].close(); |
|
_logs[Logger::DEBUG_LOG].close(); |
|
|
|
#else |
|
|
|
#ifdef PEGASUS_OS_ZOS |
|
System::closelog(); |
|
|
|
#endif |
|
|
#endif | #endif |
| |
} | } |
|
|
| |
private: | private: |
| |
|
#ifdef PEGASUS_OS_ZOS |
|
CString logIdendity; |
|
#endif |
ofstream _logs[int(Logger::NUM_LOGS)]; | ofstream _logs[int(Logger::NUM_LOGS)]; |
}; | }; |
| |