version 1.23, 2004/06/22 22:06:23
|
version 1.28, 2005/02/06 21:13:14
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., 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.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // 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. |
// | // |
// 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 |
|
|
// Modified By: Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com) | // Modified By: Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com) |
// Amit K Arora, IBM (amita@in.ibm.com) for PEP#101 | // Amit K Arora, IBM (amita@in.ibm.com) for PEP#101 |
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) | // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#2498 |
|
// Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
_STRLEN_MAX_UNSIGNED_INT + (_STRLEN_MAX_PID_TID * 2) + 8 ]; | _STRLEN_MAX_UNSIGNED_INT + (_STRLEN_MAX_PID_TID * 2) + 8 ]; |
sprintf( | sprintf( |
message, | message, |
|
#if defined(PEGASUS_OS_VMS) |
|
// |
|
// pegasus_thread_self returns long-long-unsigned. |
|
// |
|
// "[%d:%llu:%s:%u]: ", |
|
"[%x:%llx:%s:%u]: ", |
|
System::getPID(), |
|
pegasus_thread_self(), |
|
#else |
"[%d:%u:%s:%u]: ", | "[%d:%u:%s:%u]: ", |
System::getPID(), | System::getPID(), |
Uint32(pegasus_thread_self()), | Uint32(pegasus_thread_self()), |
|
#endif |
fileName, | fileName, |
lineNum); | lineNum); |
| |
|
|
message = new char[ strlen(fileName) + | message = new char[ strlen(fileName) + |
_STRLEN_MAX_UNSIGNED_INT + (_STRLEN_MAX_PID_TID * 2) + 8 ]; | _STRLEN_MAX_UNSIGNED_INT + (_STRLEN_MAX_PID_TID * 2) + 8 ]; |
| |
|
#if defined(PEGASUS_OS_VMS) |
|
// |
|
// pegasus_thread_self returns long-long-unsigned. |
|
// |
|
sprintf( |
|
message, |
|
"[%d:%llu:%s:%u]: ", |
|
System::getPID(), |
|
pegasus_thread_self(), |
|
fileName, |
|
lineNum); |
|
#else |
sprintf( | sprintf( |
message, | message, |
"[%d:%u:%s:%u]: ", | "[%d:%u:%s:%u]: ", |
|
|
Uint32(pegasus_thread_self()), | Uint32(pegasus_thread_self()), |
fileName, | fileName, |
lineNum); | lineNum); |
|
#endif |
_trace(traceComponent,message,fmt,argList); | _trace(traceComponent,message,fmt,argList); |
| |
va_end(argList); | va_end(argList); |
|
|
message = new char[ strlen(fileName) + | message = new char[ strlen(fileName) + |
_STRLEN_MAX_UNSIGNED_INT + (_STRLEN_MAX_PID_TID * 2) + 8 ]; | _STRLEN_MAX_UNSIGNED_INT + (_STRLEN_MAX_PID_TID * 2) + 8 ]; |
| |
|
#if defined(PEGASUS_OS_VMS) |
|
// |
|
// pegasus_thread_self returns long-long-unsigned. |
|
// |
|
sprintf( |
|
message, |
|
"[%d:%llu:%s:%u]: ", |
|
System::getPID(), |
|
pegasus_thread_self(), |
|
fileName, |
|
lineNum); |
|
#else |
sprintf( | sprintf( |
message, | message, |
"[%d:%u:%s:%u]: ", | "[%d:%u:%s:%u]: ", |
|
|
Uint32(pegasus_thread_self()), | Uint32(pegasus_thread_self()), |
fileName, | fileName, |
lineNum); | lineNum); |
|
#endif |
_trace(traceComponent,message,fmt,argList); | _trace(traceComponent,message,fmt,argList); |
va_end(argList); | va_end(argList); |
| |
|
|
// Construct the message header | // Construct the message header |
// The message header is in the following format | // The message header is in the following format |
// timestamp: <component name> [file name:line number] | // timestamp: <component name> [file name:line number] |
if (strcmp(message,"") != 0) |
if (*message != '\0') |
{ | { |
// << Wed Jul 16 10:58:40 2003 mdd >> _STRLEN_MAX_PID_TID is not used in this format string | // << Wed Jul 16 10:58:40 2003 mdd >> _STRLEN_MAX_PID_TID is not used in this format string |
msgHeader = new char [strlen(message) | msgHeader = new char [strlen(message) |
|
|
// Needs to be updated if additional info is added | // Needs to be updated if additional info is added |
// | // |
tmpBuffer = new char[_STRLEN_MAX_PID_TID + 6]; | tmpBuffer = new char[_STRLEN_MAX_PID_TID + 6]; |
|
#if defined(PEGASUS_OS_VMS) |
|
// |
|
// pegasus_thread_self returns long-long-unsigned. |
|
// |
|
sprintf(tmpBuffer, "[%u:%llu]: ", System::getPID(), |
|
pegasus_thread_self()); |
|
#else |
sprintf(tmpBuffer, "[%u:%u]: ", System::getPID(), | sprintf(tmpBuffer, "[%u:%u]: ", System::getPID(), |
Uint32(pegasus_thread_self())); | Uint32(pegasus_thread_self())); |
|
#endif |
msgHeader = new char [ strlen(timeStamp) + strlen(TRACE_COMPONENT_LIST[traceComponent]) + | msgHeader = new char [ strlen(timeStamp) + strlen(TRACE_COMPONENT_LIST[traceComponent]) + |
strlen(tmpBuffer) + 1 + 5 ]; | strlen(tmpBuffer) + 1 + 5 ]; |
| |
|
|
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
Uint32 Tracer::setTraceFile(const char* traceFile) | Uint32 Tracer::setTraceFile(const char* traceFile) |
{ | { |
|
if (*traceFile == 0) |
|
{ |
|
return 1; |
|
} |
|
|
String moduleName = _getInstance()->_moduleName; | String moduleName = _getInstance()->_moduleName; |
if (moduleName == String::EMPTY) | if (moduleName == String::EMPTY) |
{ | { |