logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale King" <dalewk...@gmail.com>
Subject A few problems to report
Date Fri, 02 May 2008 02:59:55 GMT
ReconnectionDelay is not working for XMLSocketAppender. This method is

void SocketAppenderSkeleton::fireConnector()
        synchronized sync(mutex);
        if (thread.isActive()) {
                thread.run(monitor, this);

You need a ! on the if condition,

I was also playing around with using TimeBasedRollingPolicy as a
TriggeringPolicy for rolling a file, but using a
FixedWindowRollingPolicy as the RollingPolicy. This did not work as I
expected. every logging event was triggering rollover so every file
contained only 1 log event. This is because lastFileName is only
updated in the rollover method

I'm not sure this is supposed to be supported, but it would seem like
it should work. This also means that using TimeBasedRollingPolicy to
trigger a SMTPAppender will not work correctly and will flood your
inbox with an email for every message!

Also on Windows when I have other threads running like the one to do
reconnection to a socket then my app does not shut down cleanly. When
it ends I get this message on the console:

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

and I get an unknown software exception (0x40000015).

If I add an XMLSocketAppender (with the fix from above so the thread
actually runs) and the thread is sleeping then when main exits there
is a delay (equal to the reconnectionDelay) then the exception occurs.
I think the problem is that the SocketAppender is destroyed but the
monitor thread is continuing to sleep when it wakes up it is not
checking if it was interrupted like FileWatchdog does.

I can get rid of the exception by doing a thread.join in the close
method and changing the monitor code to check for being interrupted
like this:

                        if( !socketAppender->thread.interrupted() )

LogLog::debug(LogString(LOG4CXX_STR("Attempting connection to "))
                                    + socketAppender->address->getHostName());
                            socket = new
Socket(socketAppender->address, socketAppender->port);
                            Pool p;
                            socketAppender->setSocket(socket, p);
established. Exiting connector thread."));
                        return NULL;

But that does not get rid of the delay waiting for the sleep to end. I
don't understand why the sleep is not interrupted in this thread, but
FileWatchdog does not have the same problem. The call to sleep from
FileWatchdog does not keep the app from exiting.

I hope you're planning on a 0.10.1 version soon.

Dale King

View raw message