Certainly, everyone assumes that a Logger
is going to be thread-safe. And (IMO) it is a reasonable working assumption. However, you would need to look at the code / javadocs of the implementation classes behind the facade to be absolutely sure.
I found the following statements on thread safety for various mainstream implementations:
(Obviously, these are statements that the respective code is designed to thread-safe. There can always be bugs. For example, were at the time of writing a couple of open thread-safety bugs in the Log4j 2 tracker, though it doesn't seem like those bugs would directly affect your example code.)
In fact, it is not possible to guarantee that a Logger
will always be thread-safe. Someone could implement their own slf4j compatible logging classes. Such an implementation could be non-thread-safe, by accident or by design. If it was, then the Logger
exposed via the slf4j facade would also be non-thread-safe.