You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by "Stefan.Borovac@t-online.de" <St...@t-online.de> on 2008/09/04 15:20:34 UTC

AsynchAppender, XMLSocketAppender and fast dying application

Hi All,

I'am currently working with log4cxx 0.10.0 on W-XP using MSVC 2005 Group
Edition.
The problem I have is the following. I use an AnsycAppender which uses
an 
XMLSocketAppender to publish events. 

When my application is going to terminate in the main method and no
event was send to the server
(chainsaw at the moment), the application hangs while performing
"LogManager::shutdown();" and
does not terminate.

What I figured out so far is, that the XMLLayout is using
"log4cxx::helpers::Transform::appendEscapingCDATA" 
which initialises some static variables. This initialisation interferes
with an "atexit" handler. The result 
is, that appendEscapingCDATA never returns. Hence, the thread of the
AsyncAppender never returns and the
whole application does not terminate.

A remedy is to perform the initialisation in advance, like this:

      {
        LogString buf;
        LogString input;
        log4cxx::helpers::Transform::appendEscapingCDATA(buf, input);
      }

This helps, but is not very intentional. Are there nicer solutions
available (a sleep also
works, but one needs different periods in RELEASE/DEBUG mode)?

Cheers
  Stefan