[ 
https://issues.apache.org/jira/browse/LOG4PHP-196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13474433#comment-13474433
 ] 

Steve Howe commented on LOG4PHP-196:
------------------------------------

Hey Ivan. I'm not sure if Kyle tested this bug in the latest code, however I 
don't think flock() will solve the issue when *multiple* PHP processes are 
trying to read/write/roll the log file on Windows. (Think multiple Windows CLI 
php-win.exe processes running and trying to roll the same log file at the 
near/same time.)

The PHP documentation on flock() is a bit cryptic, but the 2nd "Warning" doc 
block in the Notes section mentions the limitations of flock() on Windows here: 
http://php.net/manual/en/function.flock.php

Some other posts relating to the limitation of flock() on Windows:
* http://bytes.com/topic/php/answers/487428-php-instances-writing-same-file
* 
http://cubicspot.blogspot.com/2010/10/forget-flock-and-system-v-semaphores.html

Thanks for your help with this, Ivan! Hopefully it will help someone else too.
                
> Appender Rolling File: Seperate PHP processes attempting to roll the same log 
> file will truncate the log.
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4PHP-196
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-196
>             Project: Log4php
>          Issue Type: Bug
>          Components: Code
>    Affects Versions: 2.2.1
>         Environment: Windows
>            Reporter: Kyle Wiering
>              Labels: bug, fix, patch
>             Fix For: 2.3.0
>
>         Attachments: config_roll_windows.xml, fileroller.php, filewriter.php, 
> LoggerAppenderRollingFileWindows.php, 
> LoggerAppenderRollingFileWindowsTest.php, LoggerAutoloader.php
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Attaching a class extension to LoggerAppenderRollingFile named 
> LoggerAppenderRollingFileWindows. This class enacts 'blocking' to keep 
> seperate PHP processes from truncating the log file by attempting to roll the 
> logs at/near the same exact time.  It also uses a 'rename' in a manner that 
> is much quicker then a copy for large files.  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to