我刚开始使用 log4cxx,做了一个小应用程序来熟悉它。我用 Visual Studio 2005 编译,没有警告或错误。基本上看起来像:
#includes<...>
...
...
LoggerPtr logger(Logger::getLogger("MyApp"));
void main(...)
{
//some logs here
}
它按预期工作,直到我在尝试销毁全局Logger对象时遇到异常时关闭应用程序。这是跟踪:
log4cxx.dll!apr_pool_cleanup_kill(apr_pool_t * p=0xdddddddd, const void * data=0x01cf6158, int (void *)* cleanup_fn=0x10174250) Line 1981 + 0x3 bytes
log4cxx.dll!apr_pool_cleanup_run(apr_pool_t * p=0xdddddddd, void * data=0x01cf6158, int (void *)* cleanup_fn=0x10174250) Line 2025
log4cxx.dll!apr_thread_mutex_destroy(apr_thread_mutex_t * mutex=0x01cf6158) Line 133
log4cxx.dll!log4cxx::helpers::Mutex::~Mutex() Line 57
log4cxx.dll!log4cxx::Logger::~Logger() Line 55 + 0xb bytes
log4cxx.dll!log4cxx::Logger::`vbase destructor'() + 0x19 bytes
log4cxx.dll!log4cxx::Logger::`vector deleting destructor'() + 0x5a bytes
log4cxx.dll!log4cxx::helpers::ObjectImpl::releaseRef() Line 46 + 0x39 bytes
log4cxx.dll!log4cxx::Logger::releaseRef() Line 63
log4cxx.dll!log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT<log4cxx::Logger>() Line 100 + 0x33 bytes
NodeBHeartBeat.exe!`dynamic atexit destructor for 'logger''() + 0x2b bytes
msvcr80d.dll!doexit(int code=0x00000000, int quick=0x00000000, int retcaller=0x00000001) Line 553
msvcr80d.dll!_cexit() Line 413 + 0xb bytes
msvcr80d.dll!__CRTDLL_INIT(void * hDllHandle=0x6c710000, unsigned long dwReason=0x00000000, void * lpreserved=0x00000001) Line 389
msvcr80d.dll!_CRTDLL_INIT(void * hDllHandle=0x6c710000, unsigned long dwReason=0x00000000, void * lpreserved=0x00000001) Line 214 + 0x11 bytes
ntdll.dll!774b9960()
有人知道为什么会这样吗?谢谢