Alex, Sorry that I was occupied by a release effort for a while. Basically, I think there are two things I wanted to point out. 1. This patch works well for me, and my software is writing rotating log files of 100M files every 30 mins averagely on a busy deployment. There is no noticeable impact on performance and missing log issue. 2. If you take a look at the section in question, it's obvious that the check is done no matter what in there anyways. (The original code is just surrender, do nothing...
Alex, Yes, I can confirm that is opened because one line of log is written before it's closed. Maybe is due to the process is being forked. Regarding the performance impact, if you take a closer look at the patch, the code before the patch has already done the check, but it comments that it doesn't know what to do with it. < if (!::write(_fd, message.data(), message.length())) { < // XXX help! help! < } We just added one more condition if it failed the check because of the file desriptor is being...
Alex, Yes, I can confirm that is opened because one line of log is written before it's closed. Maybe is due to the process is being forked. Regarding the performance impact, if you take a closer look at the patch, the code before the patch has already done the check, but it comments don't knw what to do with it. < if (!::write(_fd, message.data(), message.length())) { < // XXX help! help! < } We just added one more condition if it failed the check because of the file desriptor is being closed, then...
Hi Alex, The symptom of the problem started to show when we deployed the service on Oracle Linux 7. It appeared that when the service was restarted, the log file stopped updating. I checked the process's open file descriptor with "lsof" utility, it appeared that the file descriptor disappeared from the list. With an attempt to check for errno == EBADF (bad file descriptor) when encounter writing issue, we can reopen the file for an extra attempt. Just a quick fix that works for me. Leo
The reason why I used sizeWrite to store the write result simply because I was using...
The reason why I used sizeWrite to store the write result simply because I was using...
Thanks for the good work on the log4cpp project. It's been a great help on the product...
FileAppender handles file descriptor closed