logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Burkett" <Steve.Burk...@symyx.com>
Subject RE: RollingFileAppender & concurrency
Date Tue, 14 Nov 2006 19:39:41 GMT
(thanks Ron for your help on this! :)

After researching this a bit, neither %processid nor minimal lock is ideal.  What would be
ideal, is if I could hook into the rollingfileappender's File property so that we can try
something like this:

(1) create a name (like  Foo.log, based on the file name specified in the config file for
the rollingfileappender)
(2) try to open the file 
(3) if it opens, good, that's the file name
(4) if it doesn't, then try another using a deterministic pattern: (e.g. "Foo.log.Alt1"),
until the appender can file a file name that is not locked.   This file name then be the basis
for rolling file names (like Foo.log.Alt1.1)

We need file names to be deterministic, but work in a webgarden scenario.

-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Monday, November 13, 2006 7:42 PM
To: log4net-user@logging.apache.org
Subject: Re: RollingFileAppender & concurrency

If you want the processid pattern to be processed, you need to use a file node with type PatternString:

<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
 <file type="log4net.Util.PatternString" value="[%processid].log" />
 <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
 <appendToFile value="false" />
 <layout type="log4net.Layout.SimplePatternLayout" />

Have you tried an appender node that uses the alternate lockingModel node and PatternString
file type?

----- Original Message ----
From: Steve Burkett <Steve.Burkett@symyx.com>
To: Log4NET User <log4net-user@logging.apache.org>; rongrabowski@yahoo.com
Sent: Monday, November 13, 2006 8:46:33 PM
Subject: RE: RollingFileAppender &  concurrency

I just saw this blog entry that suggest using %processid. This would be ideal...


    <appender name="File" type="log4net.Appender.RollingFileAppender">
      <file type="log4net.Util.PatternString" value="C:\temp\MyApp_[%processid].log" />

However,  on my system, using

    <appender name="Loadtest.Debug" type="log4net.Appender.RollingFileAppender, log4net,
Version=, Culture=neutral, PublicKeyToken=b32731d11ce58905">
            <param name="File" value=".\[%processid]LoadTest.log" />

Created a file name " [%processid]LoadTest.log", and showed same locking contentions.

We have to use rollingfileappenders, because our customers require us to have NO additional
dependencies on databases. 

-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com]

Sent: Monday, November 13, 2006 5:18 PM
To: Log4NET User
Subject: Re: RollingFileAppender & concurrency

Are you generating a lot of logs? Keep in mind that the RollingFileAppender is not a database.
Have you looking using something like MSDE and the AdoNetAppender as a storage place for logs
on each machine? This link shows how to setup an alternate locking model on a FileAppender:


Opening and closing a file after each write will never be as fast as an exclusive lock.

----- Original Message ----

From: Steve Burkett <Steve.Burkett@symyx.com>

To: log4net-user@logging.apache.org

Sent: Monday, November 13, 2006 6:50:25 PM

Subject: RollingFileAppender &  concurrency



   We have a .Net v2 asp.net webservice that uses log4net. Our customers want to run our product
in a webgarden (multiple processes running on the same machine).  Each process, uses the same
web.config, and thus the same RollingFileAppender file name.


   Will the service interleave the log calls to the single file correct? (a simple test I
did with a console app, running in two windows, didn’t interleave correctly).


   Is there a switch on RollingFileAppender to allow concurrency?  Another (file based) appender?


   Thanks! J

Notice: This e-mail message, together with any attachments, contains
information of Symyx Technologies, Inc. or any of its affiliates or
subsidiaries that may be confidential, proprietary, copyrighted,
privileged and/or protected work product, and is meant solely for
the intended recipient. If you are not the intended recipient, and
have received this message in error, please contact the sender
immediately, permanently delete the original and any copies of this
email and any attachments thereto.

View raw message