I am using log4net 1.2.10. It has been stated on this forum that from 1.2.9
onwards, different file locking schemas are available. I have configured
log4net as per examples given to use a non-default method (minimal-locking
or interprocess locking) but the immediate effect is the following error
message:
log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [lockingModel]
to set object on
[log4net.Repository.Hierarchy.DefaultLoggerFactory+LoggerImpl]
log4net:ERROR [RollingFileAppender] Unable to acquire lock on file
C:\Program Files (x86)\Autoscribe\Matrix Gemini LIMS\Exe\log\Trace.log. The
process cannot access the file 'C:\Program Files (x86)\Autoscribe\Matrix
Gemini LIMS\Exe\log\Trace.log' because it is being used by another process.
My log4net.config file is:
<logger name="Matrix.Trace">
<level value="OFF" />
<lockingModel
type="log4net.Appender.FileAppender+InterProcessLock"
/>
<appender-ref ref="RollingFileAppenderTRACE" />
</logger>
<appender name="RollingFileAppenderTRACE"
type="log4net.Appender.RollingFileAppender">
<file value=".\log\Trace.log" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%newline" />
</layout>
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
</appender>
etc...
My C# application does this:
private static readonly ILog bllDebugLog =
LogManager.GetLogger("Matrix.Trace"); //for debugging
and
log4net.Config.XmlConfigurator.ConfigureAndWatch(new
System.IO.FileInfo("log4net.config"));
If I use the default locking method, logging does work (but I have file-lock
problems with multiple processes, which is what I am trying to resolve).
I cannot see from the log4net documentation why this should fail. What am I
doing wrong?
TIA
--
View this message in context:
http://apache-logging.6191.n7.nabble.com/Multiple-processes-logging-to-single-file-unexplained-error-message-tp42667.html
Sent from the Log4net - Users mailing list archive at Nabble.com.