logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chihhsiw <chihh...@gmail.com>
Subject Log4CXX hang
Date Mon, 21 May 2018 09:37:13 GMT
  Thanks for reading this post. I have a C program running on CentOS 5.11,
compiled through g++ calling a C++ library and this C++ library try to use
log4cxx to do logging. However, when I initialize 
LoggerPtr Log4XXLogger::loggerMyMain(Logger::getLogger( "main")); as global
variable, my program hang at startup and gdb stack is like

#0  0xffffe405 in __kernel_vsyscall ()
#1  0x0067bcc5 in pthread_cond_wait@@GLIBC_2.3.2 () from
#2  0x0096b9cc in __cxa_guard_acquire () from /usr/lib/libstdc++.so.6
#3  0xf764fa0e in log4cxx::helpers::Transcoder::decode (src="70023",
dst="Mutex exception: stat = ") at transcoder.cpp:247
#4  0xf763b7b1 in log4cxx::helpers::StringHelper::toString (n=70023,
pool=..., s="Mutex exception: stat = ") at stringhelper.cpp:108
#5  0xf75c6644 in log4cxx::helpers::MutexException::formatMessage
(stat=70023) at exception.cpp:228
#6  0xf75c66ef in log4cxx::helpers::MutexException::MutexException
(this=0x866eb38, stat=70023) at exception.cpp:213
#7  0xf7600c4a in log4cxx::helpers::Mutex::Mutex (this=0x8666a30, p=...) at
#8  0xf75a4e56 in LocaleCharsetDecoder () at charsetdecoder.cpp:360
#9  log4cxx::helpers::CharsetDecoder::createDefaultDecoder () at
#10 0xf75a51b1 in log4cxx::helpers::CharsetDecoder::getDefaultDecoder () at
#11 0xf764fb28 in log4cxx::helpers::Transcoder::decode (src="main", dst="")
at transcoder.cpp:247
#12 0xf75f8bc8 in log4cxx::LogManager::getLogger (name="main") at
#13 0xf75f0812 in log4cxx::Logger::getLogger (name=0xf778f9a0 "main") at
#14 0xf778d769 in Log4CXXLoggerInner::Log4CXXLoggerInner (this=0xf7799ba8)
at log4CXXLoggerInner.cpp:7
#15 0xf778d35d in __static_initialization_and_destruction_0
(__initialize_p=1, __priority=65535) at log4XXLogger.cpp:4
#16 0xf778d399 in global constructors keyed to
_ZN12Log4XXLogger10log4cInnerE() () at log4XXLogger.cpp:30
#17 0xf778dfc6 in __do_global_ctors_aux () from
#18 0xf776c10d in _init () from
#19 0x004fc493 in call_init () from /lib/ld-linux.so.2
#20 0x004fc5a3 in _dl_init_internal () from /lib/ld-linux.so.2
#21 0x004ee84f in _dl_start_user () from /lib/ld-linux.so.2

but if I make it as part of class, start the global variable as NULL and
then new and assign as class A below

class A
           string appPath = getenv("APPDIR");
           appPath = appPath + "/" + LOG4CXX_CONFIG_FILE_NAME;

           // Load configuration file
           m_serviceLogger = Logger::getLogger("tuxedoService");

    void log()
        LOG4CXX_ERROR(m_serviceLogger, "This is a Test log");

    LoggerPtr m_serviceLogger;

my log message is unpredictable, sometimes produce 0 line sometimes produces
many lines. 

Can anybody tell me how to resolve this issue?


Sent from: http://apache-logging.6191.n7.nabble.com/Log4cxx-Users-f30946.html

View raw message