commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject RE: [Logging] Thread safety guaruntee of Log classes?
Date Wed, 11 Dec 2002 19:03:40 GMT


On Wed, 11 Dec 2002, Jerome Jacobsen wrote:

> Date: Wed, 11 Dec 2002 13:12:49 -0500
> From: Jerome Jacobsen <jerome.jacobsen@gentootech.com>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>,
>      jerome.jacobsen@gentootech.com
> To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> Subject: RE: [Logging] Thread safety guaruntee of Log classes?
>
> I guessed that.  However one should program to the API contract.  One
> benefit of using the Commons Logging API wrapper layer was to allow
> switching implementations.  If you are assuming thread safety as Struts
> seems to be, then switching to a non-thread safe implementation would break
> your application.
>
> So, is the contract of Log supposed to guarantee thread-safety?  Despite
> what Struts assumes I'll assume no until I hear otherwise.
>

The contract of Log *itself* makes no guarantees about thread safety.  It
is up to you to use (or write) a thread-safe logging implementation if you
use logging in a multi-threaded environment such as a servlet container.

Essentially, that's the case for *any* class library used in a
multi-thread environment.  Logging isn't really a special case.

Craig


Mime
View raw message