You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by Stefan Bodewig <bo...@apache.org> on 2011/09/06 17:04:59 UTC

Does MinimalLock actually work with AppendToFile = false?

Hi,

while looking into the failing unit tests I started to wonder whether
TestMinimalLockUnlocks in RollingFileAppenderTest has ever passed - and
if it actually can.

The test uses a RollingFileAppender with AppendToFile=false and a
MinimalLock locking model.  Since the MinimalLockingModel re-opens the
file for each message it is going to overwrite the existing file - this
is what the code does and why the test fails.

As I've never used MinimalLock myself I don't know whether it is
supposed for the append=false case at all - at least the docs don't say
it wouldn't work.

Stefan

Re: Does MinimalLock actually work with AppendToFile = false?

Posted by Stefan Bodewig <bo...@apache.org>.
On 2011-09-06, Stefan Bodewig wrote:

> while looking into the failing unit tests I started to wonder whether
> TestMinimalLockUnlocks in RollingFileAppenderTest has ever passed - and
> if it actually can.

I should have looked through svn history first.  svn revision 607475
which adds the new (undocumented AFAICS) MutextLock LockingModel has
broken the test by removing a tiny little line (resetting m_append to
true after opening the file for the first time).  Should be fixed in a
second.

Stefan