[logback-user] logback and thread safety?

Ralph Goers rgoers at apache.org
Mon Jul 11 08:05:10 CEST 2011

I don't know that it is necessary to include a comment on thread safety when every class is intended to be thread safe. It would make more sense to mention thread safety when a class is not. 

Yes, Logback is thread-safe. However, some appenders still use AppenderBase which assumes the Appender is not thread safe and so locks every call to format and write out the event.


On Jul 10, 2011, at 10:10 PM, Boyer, Brent B wrote:

> Does anyone know of where the documentation is concerning lobagback and thread safety?
> Logback, particularly high level "user facing" classes like Logger, has to be multithread safe, right?  I cannot imagine otherwise, but I there seems to be no thorough discussion of its thread safety.
> On the logback website, the sole discussion I found was this brief mention in the manual:
> 	"All appenders shipped with the logback distribution extend the AppenderBase abstract class that implements the doAppend method in a synchronized block ensuring thread-safety."
> 	http://logback.qos.ch/manual/architecture.html
> I also found this 4 year old posting to this email list
> 	http://old.nabble.com/logback-and-concurrency-to10189585.html#a10311135
> in which no less than Ceki Gülcü says that logback is thread safe.  But he gives no details.
> Every single logback class javadoc that I looked at is silent about MT safety.  (Indeed, there seem to be minimal javadocs about anything.  It ought to be a requirement that every single class committed to source control includes in its class javadoc a comment about thread safety.)
> A web search found one person claiming a bug (in slf4j) here:
> 	http://neopatel.blogspot.com/2010/12/slf4j-over-sysout-not-thread-safe.html
> If anyone knows where this is discussed more thoroughly, please share the link(s).
> Also, if this question is more appropriate for the dev list, let me know and I will do that.
> This communication is for informational purposes only. It is not
> intended as an offer or solicitation for the purchase or sale of
> any financial instrument or as an official confirmation of any
> transaction. All market prices, data and other information are not
> warranted as to completeness or accuracy and are subject to change
> without notice. Any comments or statements made herein do not
> necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
> and affiliates.
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to European legal entities.
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

More information about the Logback-user mailing list