Rakesh Sehgal created LOGCXX-441: ------------------------------------ Summary: Log4cxx SocketAppender leads to application crash Key: LOGCXX-441 URL: https://issues.apache.org/jira/browse/LOGCXX-441 Project: Log4cxx Issue Type: Bug Components: Appender Affects Versions: 0.10.0 Environment: CentOS, RHEL, C++11 Reporter: Rakesh Sehgal Fix For: 0.11.0
I am using log4cxx and recently started working with SocketAppender. I use the following: java org.apache.log4j.net.SimpleSocketServer 4712 log4j-server.properties and am able to write logs on the server. I do also have a local SizeRollover policy setup. This all works fine, until I stop running the SimpleSockerServer. At which point my C++ application crashes, I think after the ReconnectionDelayTime specified in the properties file. Below is the gdb output from crash: 0 0x0000003c5fa0e6fd in write () from /lib64/libpthread.so.0 1 0x00007ffff79eade7 in apr_socket_send () from /usr/lib64/libapr-1.so.0 2 0x00007ffff7d52bb1 in log4cxx::helpers::Socket::write(log4cxx::helpers::ByteBuffer&) () from /usr/lib64/liblog4cxx.so.10 3 0x00007ffff7d595ed in log4cxx::helpers::SocketOutputStream::flush(log4cxx::helpers::Pool&) () from /usr/lib64/liblog4cxx.so.10 4 0x00007ffff7d5468c in log4cxx::net::SocketAppender::append(log4cxx::helpers::ObjectPtrT const&, log4cxx::helpers::Pool&) () from /usr/lib64/liblog4cxx.so.10 5 0x00007ffff7cd7d9d in log4cxx::AppenderSkeleton::doAppend(log4cxx::helpers::ObjectPtrT const&, log4cxx::helpers::Pool&) () from /usr/lib64/liblog4cxx.so.10 6 0x00007ffff7cd50f4 in log4cxx::helpers::AppenderAttachableImpl::appendLoopOnAppenders(log4cxx::helpers::ObjectPtrT const&, log4cxx::helpers::Pool&) () from /usr/lib64/liblog4cxx.so.10 7 0x00007ffff7d1adfd in log4cxx::Logger::callAppenders(log4cxx::helpers::ObjectPtrT const&, log4cxx::helpers::Pool&) const () from /usr/lib64/liblog4cxx.so.10 8 0x00007ffff7d1c4ac in log4cxx::Logger::forcedLog(log4cxx::helpers::ObjectPtrT const&, std::basic_string, std::allocator > const&, log4cxx::spi::LocationInfo const&) const () from /usr/lib64/liblog4cxx.so.10` As an improvement, Is it possible to make log4cxx write logs to a local file in case the server stops? If I start the server again, before the application crashes, SocketAppender does not receive the logs again. Any other suggestions to send logs over the network? -- This message was sent by Atlassian JIRA (v6.3.4#6332)