https://issues.apache.org/jira/browse/LOG4J2-1797
Added comment. On Thu, May 11, 2017 at 4:11 PM, Matt Sicker <[email protected]> wrote: > So this is something to consider with an async appender API. I don't > remember the ticket number, but there's one about such an API, and handling > recursive logging may be handled more generically in such an API. > > On 11 May 2017 at 07:58, Mikael Ståldal <[email protected]> wrote: > > > The Kafka client library spawns its own threads, so this recursive > logging > > is most likely done on another thread. That explains why the > > AppenderControl prevention does not work. > > > > So we should keep the prevention in KafkaAppender. > > > > On Thu, May 11, 2017 at 2:50 PM, Apache <[email protected]> > > wrote: > > > > > How does AppenderControl not prevent recursive logging? If the appender > > > gets called a second time on the thread then it will ignore the event. > > If > > > the appender or Kafka are creating new threads that are logging then > you > > > could get the behavior you mention, but I don't see how that could be > > > handled generically. I think the FlumeAppender may do something to > > prevent > > > this as well. > > > > > > Ralph > > > > > > > On May 11, 2017, at 5:39 AM, Mikael Ståldal < > [email protected] > > > > > > wrote: > > > > > > > > The Kafka appender uses the Kafka client library, and that client > > library > > > > does it's own logging through SLF4J, it always emits a few log > messages > > > at > > > > DEBUG level on each message sent. > > > > > > > > If you have log4j-slf4j-impl in classpath and enable DEBUG logging > > > through > > > > KafkaAppender, you will get recursive logging, and the application > gets > > > > stuck. > > > > > > > > The recursive logging prevention in AppenderControl does not protect > > > > against this as far as I can see. I have put in some protection in > > > > KafkaAppender: > > > > https://github.com/apache/logging-log4j2/blob/master/ > > > log4j-core/src/main/java/org/apache/logging/log4j/core/ > > appender/mom/kafka/ > > > KafkaAppender.java#L133 > > > > > > > > Without this, you get recursive logging. > > > > > > > > -- > > > > [image: MagineTV] > > > > > > > > *Mikael Ståldal* > > > > Senior software developer > > > > > > > > *Magine TV* > > > > [email protected] > > > > Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com > > > > > > > > Privileged and/or Confidential Information may be contained in this > > > > message. If you are not the addressee indicated in this message > > > > (or responsible for delivery of the message to such a person), you > may > > > not > > > > copy or deliver this message to anyone. In such case, > > > > you should destroy this message and kindly notify the sender by reply > > > > email. > > > > > > > > > > > > > > > -- > > [image: MagineTV] > > > > *Mikael Ståldal* > > Senior software developer > > > > *Magine TV* > > [email protected] > > Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com > > > > Privileged and/or Confidential Information may be contained in this > > message. If you are not the addressee indicated in this message > > (or responsible for delivery of the message to such a person), you may > not > > copy or deliver this message to anyone. In such case, > > you should destroy this message and kindly notify the sender by reply > > email. > > > > > > -- > Matt Sicker <[email protected]> > -- [image: MagineTV] *Mikael Ståldal* Senior software developer *Magine TV* [email protected] Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email.
