[logback-user] Log4j LoggingEvent

Ceki Gulcu ceki at qos.ch
Wed May 13 19:37:16 CEST 2009

Greg Flex wrote:
> Hi Ceki,
> It is (kind of) clear. The only part I have problems with is: "...Place 
> logging events in a queue, and if the queue becomes full, drop new 
> events..."
> How exactly I'd do this? Do I have to implement some method that "drops 
> new events if the queue becomes full" or there's already
> something built-in.

You would need to modify AsyncAppender so that instead of blocking, it drops 
events. I would think that it would be a fairly easy modification to make.

> I know that (From the Log4j Manual: "...If however the queue is full, 
> then AsyncAppender.append() will not return until free space becomes 
> available." ) So if the queue becomes full the dispatcher thread will 
> try to free the space by removing the oldest events from the queue and 
> dispatch them to each attached appender but if the only appender is the 
> SocketAppender that can't process anything at the moment, since
> there's no comunication to the server, what's going to happend?

Events will be dropped. (You can't have your cake and eat it too.)

Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.

More information about the Logback-user mailing list