You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2020/04/04 22:30:04 UTC
[jira] [Updated] (LOG4NET-623) RollingFIleAppender creating
multiple duplicate files within a process
[ https://issues.apache.org/jira/browse/LOG4NET-623?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralph Goers updated LOG4NET-623:
--------------------------------
LOG4NET is now dormant.
> 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
>
> Attachments: Log4Net_Appender1.png, Log4Net_Appender2.png, Screen Shot 2019-01-22 at 11.41.48 PM.png, image-2019-01-28-22-14-58-706.png, log4Net_createAppender.gif
>
>
> 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
(v8.3.4#803005)