Re: Race condition stopping context
Hello, I've been taking a look at LoggerContext#stop() and for what I see there's code to prevent disruptor to take new messages but there's nothing making sure that the ring buffer is empty before actually closing up. I did a simple test with an Appender wrapper like this: final class StopConditionSafeAppenderWrapper extends BaseAppenderWrapper { private final LoggerContext loggerContext; StopConditionSafeAppenderWrapper(Appender delegate, LoggerContext loggerContext) { super(delegate); this.loggerContext = loggerContext; } @Override public void append(LogEvent event) { if (!loggerContext.isStarted()) { return; } super.append(event); } } Using this appender wrapper I still get the same error, because at the time that append was closed the context was started but by the time disruptor processed it it was already stopped (this I could verify with a debugger). Should I open a bug? Any workaround you could suggest? Thanks!
Re: Race condition stopping context
Hello Remko, I'm using 2.1. Any pointers ? On Fri, Dec 19, 2014 at 11:20 AM, Remko Popma wrote: > > We used to have this problem in older versions but these issues have been > addressed in 2.1 as far as I know. Which version are you using? > > Sent from my iPhone > > > On 2014/12/19, at 22:01, Mariano Gonzalez > wrote: > > > > Hello, > > > > I have an application in which I'm using all async loggers. When I stop > the > > LoggerContext, there're still some events waiting in disruptor's buffer > and > > when it tries to execute them the context is already closed and thus > those > > events are lost. > > > > Is there some kind of hook, callback or whatever I can use so that when > the > > context is stopped: > > > > > > - the loggers stop accepting new messages > > - the context waits for disruptor's buffer to be empty before actually > > stopping > > > > > > Thanks > > - > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > >
Re: Race condition stopping context
We used to have this problem in older versions but these issues have been addressed in 2.1 as far as I know. Which version are you using? Sent from my iPhone > On 2014/12/19, at 22:01, Mariano Gonzalez > wrote: > > Hello, > > I have an application in which I'm using all async loggers. When I stop the > LoggerContext, there're still some events waiting in disruptor's buffer and > when it tries to execute them the context is already closed and thus those > events are lost. > > Is there some kind of hook, callback or whatever I can use so that when the > context is stopped: > > > - the loggers stop accepting new messages > - the context waits for disruptor's buffer to be empty before actually > stopping > > > Thanks - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org