Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-441

Log4cxx SocketAppender leads to application crash

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 0.10.0
    • Fix Version/s: None
    • Component/s: Appender
    • Labels:
    • Environment:
      CentOS, RHEL, C++11


      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?




            • Assignee:
              rakeshsehgal1 Rakesh Sehgal


              • Created:

                Issue deployment