Hello,

I have a multi-threaded application using log4net 1.2.10 for logging.
There are a couple of points when the application runs where there are
a large number of logs occurring simultaneously from multiple threads
(that happen to be in different App Domains).  On occasion, I will end
up with two separate log files generated when this point in my
application occurs.  One of the log files will end up with a date
pattern twice in the name and will look something like this:

Server_2008-01-16.log
Server_2008-01-16.log2008-01-16.log

A few of the logs end up in the second log file from one of the
threads.  The remainder of the threads log to the first log file and
continue using it.  Occasionally this second log file will be used
again by another thread if the problem happens again.  Here's the
configuration file I'm using:

<log4net>
                <appender name="RollingLogFileAppender"
type="log4net.Appender.RollingFileAppender">
                                <param name="File" value=".\\logs\\Server_" />
                                <param name="AppendToFile" value="true" />
                                <param name="MaxSizeRollBackups" value="20" />
                                <param name="MaximumFileSize" value="10MB" />
                                <param name="RollingStyle" value="Composite" />
                                <param name="datePattern"
value="yyyy-MM-dd.lo\g" />
                                <param name="StaticLogFileName" value="false" />
                                <layout type="log4net.Layout.PatternLayout">
                                                <param
name="ConversionPattern" value="%d [%t] %-5p - %m%n" />
                                </layout>
                                <lockingModel
type="log4net.Appender.FileAppender+MinimalLock" />
                </appender>
                <root>
                                <level value="INFO" />
                                <appender-ref ref="RollingLogFileAppender" />
                </root>
</log4net>

It appears that perhaps a lock is failing in one of the threads, and
it by default tries to create another log file to log to.  Is it
possible to block this from happening and have the logs go into the
original log file?  If this is not possible, it would be nice if the
second log file didn't have the double date in it, or if the handling
of this was cleaner.

Thanks,
Steve

Reply via email to