|
ACE VERSION: 5.2.2
HOST MACHINE and OPERATING SYSTEM: SunOS 5.8 Generic_108528-09 sun4u sparc
SUNW,Ultra-80
TARGET MACHINE and OPERATING SYSTEM, if different from HOST: Same
COMPILER NAME AND VERSION (AND PATCHLEVEL):
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/specs
gcc version 2.95.2 19991024 (release)
AREA/CLASS/EXAMPLE AFFECTED:
[Log_Msg]
DOES THE PROBLEM AFFECT:
COMPILATION? No
LINKING? No
EXECUTION? Yes
SYNOPSIS:
When calling Ace_Log_Msg using the ACE_Log_Msg::SYSLOG
form of open logging
ceases to work after calling ACE::daemonize().
DESCRIPTION:
Example code is attached...if ACE::daemonize() is
commented out
logging to syslog works as expected. If ACE::daemonize
is called all
logging after this call does not appear to go to
syslog.
REPEAT BY:
run the attached code with ACE::daemonize() enabled and
view syslog log files.
run the attached code with ACE::daemonize() disabled
and view syslog log files.
/////////////////////////////////////////////////////////////
#include "ace/Signal.h"
#include "ace/OS.h"
#include "ace/Log_Msg.h"
ACE_Log_Msg *global_ptr;
int main( int argc, char *argv[] )
{
if( ACE_LOG_MSG->open ("mcsd", ACE_Log_Msg::SYSLOG, "mcobsd") ==
-1){
cerr << "Unable to initialize logger, quitting" <<
endl;
exit(-1);
}else{
ACE_LOG_MSG->log( LM_INFO, "mcobsd is starting");
}
ACE_Log_Msg *l = ACE_LOG_MSG;
global_ptr = ACE_LOG_MSG;
l->instance()->log( LM_INFO, "before using pointer");
global_ptr->log( LM_INFO, "before using global pointer");
ACE_LOG_MSG->log( LM_INFO, "before using macro");
//ACE::daemonize();
l->instance()->log( LM_INFO, "after using pointer");
global_ptr->log( LM_INFO, "after using global pointer");
ACE_LOG_MSG->log( LM_INFO, "after using macro");
}
/////////////////////////////////////////////////////////////
ACE::daemonize() disabled output to syslog:
May 15 16:14:36 dali mcobsd[20322]: [ID 702911
user.info] mcobsd is starting
May 15 16:14:36 dali mcobsd[20322]: [ID 702911
user.info] before using pointer
May 15 16:14:36 dali mcobsd[20322]: [ID 702911
user.info] before using global pointer
May 15 16:14:36 dali mcobsd[20322]: [ID 702911
user.info] before using macro
May 15 16:14:36 dali mcobsd[20322]: [ID 702911
user.info] after using pointer
May 15 16:14:36 dali mcobsd[20322]: [ID 702911
user.info] after using global pointer
May 15 16:14:36 dali mcobsd[20322]: [ID 702911
user.info] after using macro
ACE::daemonnize() enabled:
May 15 16:06:24 dali mcobsd[20303]: [ID 702911
user.info] mcobsd is starting
May 15 16:06:24 dali mcobsd[20303]: [ID 702911
user.info] before using pointer
May 15 16:06:24 dali mcobsd[20303]: [ID 702911
user.info] before using global pointer
May 15 16:06:24 dali mcobsd[20303]: [ID 702911
user.info] before using macro
SAMPLE FIX/WORKAROUND:
None known.
|