[
https://issues.apache.org/jira/browse/LOG4NET-623?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dominik Psenner updated LOG4NET-623:
------------------------------------
Issue Type: Task (was: Bug)
> RollingFIleAppender creating multiple duplicate files within a process
> ----------------------------------------------------------------------
>
> Key: LOG4NET-623
> URL: https://issues.apache.org/jira/browse/LOG4NET-623
> Project: Log4net
> Issue Type: Task
> Components: Appenders
> Affects Versions: 2.0.8
> Environment: Prod
> Reporter: Shrikant Mabrukar
> Assignee: Dominik Psenner
> Priority: Major
> Fix For: 2.1.0
>
>
> In a process I have multiple threads, each thread is creating a file with
> same log entries resulting in creation of multiple duplicate files within a
> process. This happens when multiple threads are trying to log same time.
> I am using RollingFIleAppender
> RollingFileAppender appender = new RollingFileAppender
> {
> Name = configuration.LoggerName,
> Layout = patternLayout,
> AppendToFile = true,
> PreserveLogFileNameExtension = true,
> CountDirection = 1,
> RollingStyle = RollingFileAppender.RollingMode.Size,
> MaxSizeRollBackups = configuration.MaxRollBackups.HasValue ?
> configuration.MaxRollBackups.Value : 4,
> MaximumFileSize = configuration.MaxFileSizeKB.HasValue == false ? "100KB" :
> $"\{configuration.MaxFileSizeKB.Value}KB",
> StaticLogFileName = false,
> File = "myFile[%processid].log"
> };
>
> Upon digging turns out log4Net is thread safe but not process safe
> [https://hectorcorrea.com/blog/log4net-thread-safe-but-not-process-safe/17]
> Tried multiple locking mechanism which are offered by Log4Net itself for
> RollingFileAppender MinimalLock, InterProcessLock and ExclusiveLock none of
> them helped. Nor does PatterString help.
>
> Any ideas on how to solve the issue?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)