[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15947044#comment-15947044 ] Dominik Psenner commented on LOG4NET-552: - 1. I couldn't find the log4net issue, but this sounds like LOG4NET-487 which is an improvement of LOG4NET-485. 2. Please open a pull request to allow code reviews. Without that we are unable to answer this question. 3. Great news, note that it is very unlikely that your patch is going to be applied if it fixes rolling by date but breaks rolling by size. > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > Attachments: Modification in AdjustFileBeforeAppend.png > > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15944804#comment-15944804 ] Dominik Psenner commented on LOG4NET-552: - 1. This changes the current behavior and therefore is probably a breaking change. 2. This hits anyone even when a mutex is not required. I don't know what side effects or collateral damage can be caused by your patch and therefore I again advice you to rethink your logging configuration. > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > Attachments: Modification in AdjustFileBeforeAppend.png > > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15944653#comment-15944653 ] Sachin Abaso Patil commented on LOG4NET-552: Hi Dominik, Could you please review and provide your comments on my question in last comment? > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > Attachments: Modification in AdjustFileBeforeAppend.png > > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15942896#comment-15942896 ] Sachin Abaso Patil commented on LOG4NET-552: Hi Dominik, We have made below changes into log4net source code of version 1.2.15 to resolve below mentioned two issues, 1. To resolve overwrite issue for time based rolling:- If file to be rolled with destination name is exists(some other process has rolled it already) then do not perform rolling. 2. To resolve issue where some log entries were missing:- During debugging log4net source code, we found that due to error “Unable to acquire lock on file C:\Log4Net_LogFiles\log.txt. The process cannot access the file 'C:\Log4Net_LogFiles\log.txt' because it is being used by another process”, acquire lock during append operation was failing thus was skipping writing log. Here we thought of below solution. We implemented and tested the solution. a. Solution1 – Using Mutex: Here we have protected AcquireLock method using system wide Mutex. And once append is done, we are releasing Mutex in ReleaseLock method. This change is made only in minimal lock model to protect append operation. During this test, total 15 processes were writing into same file simultaneously with frequency of 100ms for 15 minutes. Total 1,02,215 log entries were written and only one was skipped. No file overwrite issue happened. @Dominik, do you think any possible side effect of above change except performance? If you want we can share code screen shot for your review. Thanks, Sachin Patil > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > Attachments: Modification in AdjustFileBeforeAppend.png > > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15927616#comment-15927616 ] Dominik Psenner commented on LOG4NET-552: - I'm unsure whether we can just remove the overwriting of files. Have you tried to do your modifications and ran the tests? If I had the time to rewrite the rolling file appender, I would not implement mechanisms that overwrite files but rather find a better filename for the rolling destination. For instance consider this situation: There are the following logfiles: * Some.log [size=3MB] * Some.2017-03-16.log [size=45MB] and the time is 2017-03-16 08:30 and therefore the rolling logic would like to roll over "Some.log" again. Then I would expect this outcome: * Some.log [size=0MB] * Some.2017-03-16.log [size=45MB] * Some.2017-03-16.1.log [size=3MB] This behavior however totally breaks the mechanisms that try to limit the number of rolled files. Unfortunately modifications to the rolling file appender can have many side effects that break existing usecases and therefore we avoid patching it. As for your usecase, I again advise you to rethink your logging configuration. You should avoid having several processes that write into the same logfiles! If you want a combined log event for all the processes you have, use a remote appender / adonet appender /... > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15925763#comment-15925763 ] Sachin Abaso Patil commented on LOG4NET-552: Hi Dominik, Thanks for your response. In case of size based rolling, we would like to know purpose of deleting destination file during rollover. Is this required to protect any use case if yes then please mention. And please let us know if we modify RollFile method to not do any operation if destination file exists, do you think it will have side-effects? If yes please let us know that too. Thanks, Sachin Patil > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15925675#comment-15925675 ] Dominik Psenner commented on LOG4NET-552: - Rolling by date with multiple processes logging and rolling the same files is never going tobwork without implementing a communication channel in between the processes to share the rolling state information. I advise you to rethink your logging configuration. > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (LOG4NET-552) Incorrect behavior of RollingFileAppender while rolling files, if multiple processes appending into same file
[ https://issues.apache.org/jira/browse/LOG4NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15924088#comment-15924088 ] Sachin Abaso Patil commented on LOG4NET-552: Hi Dominik, Thanks for your response. As you know we have multiple processes writing into same log file using RollingFileAppender. Following are three important settings of RollingFileAppender we have set. And due to this after every hour rolling of log file happens. Problem we have seen is with above setting is, suppose there are 5 processes running on same machine which uses same RollingFileAppender setttings as described above. When hour changes, process 1 rolls (File.Move) main log file (say "log.txt" with size 5 MB) with rolled file named "log.txt.2017031415.log". So, now rolled file has size 5 MB and main log file has size 0 bytes. Now 2nd process will also detect hour change and will try to roll main file with is of 0 bytes with rolled file name "log.txt.2017031415.log". Thus, rolled file data vanishes. This is the problem we are facing. We have looked into code where rolling happens for RollingFileAppender. Inside RollingFileAppender.cs there is method protected void RollFile(string fromFile, string toFile) This method has code to delete destination if exists. We are thinking this is causing above issue. Could you please let us know, 1. Why DeleteFile(toFile); call is made inside method protected void RollFile(string fromFile, string toFile) of RollingFileAppender.cs ? 2. We are thinking to modify method protected void RollFile(string fromFile, string toFile) of RollingFileAppender.cs in such a way that if destination file (toFile) exists then don't do anything. Let us know your comments on this change. Thanks in advance. Sachin Patil > Incorrect behavior of RollingFileAppender while rolling files, if multiple > processes appending into same file > - > > Key: LOG4NET-552 > URL: https://issues.apache.org/jira/browse/LOG4NET-552 > Project: Log4net > Issue Type: Bug > Components: Appenders >Affects Versions: 1.2.15 > Environment: Windows Server 2008 R2 Enterprise >Reporter: Sachin Abaso Patil >Priority: Blocker > > Hi Team, > This issue has become blocker for us, as on our production environment, > multiple processes are appending log into single log file which has no issue, > but while rolling it overwrites files and thus missing log entries. > Based on link below, it looks like log file rolling mechanism of log4net is > not process safe even after using FileAppender.InterProcessLock. > Link: https://issues.apache.org/jira/browse/LOG4NET-485 > Also, in FAQ (https://logging.apache.org/log4net/release/faq.html) under > section “How do I get multiple process to log to the same file?”, it has been > clearly mentioned that, rolling files is simply not compatible with multiple > process scenario. > My questions, > 1.We are using version “1.2.15”. Are you planning to fix above mentioned > rolling issue in upcoming release? If yes then please provide tentative > release date. > 2.We had incorporated log4net in our project in year 2009, had FAQ > mentioned this limitation (rolling file not compatible with multi process) in > year 2009? Because we while studying log4net during year 2009 we do not > remember seeing this note in FAQ? > Requesting you to please respond as soon as possible with your comments. > Below is how we have configured appender for all processes, > type="log4net.Appender.RollingFileAppender"> > > > type="log4net.Appender.FileAppender+MinimalLock" /> > > > > > > > > > > > > > > Thanks, > Sachin Patil -- This message was sent by Atlassian JIRA (v6.3.15#6346)