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

Ivan Habunek commented on LOG4PHP-196:
--------------------------------------

Interesting. I'm trying to reproduce the bug locally. Take the following code:
https://gist.github.com/3874964

I start 10 processes logging to the same file at the same time, 100.000 
iterations each. Rollover is set at 100KB. When processes finish, there's 135 
files. That means 134 rollovers.

Now if I concat the 135 files into one, and count the number of lines, I get 
exactly 1 million. Therefore, I have not lost anything. 

I tried this a couple of times. I conclude that locking works as intended 
locally, at least on my 64bit Windows 7. It's a small step forward. :)

What I think could be a problem is the fact that you're logging over a network 
(you mentioned UNC paths). As far as I can tell, SMB [does support 
locking|http://en.wikipedia.org/wiki/Server_Message_Block#Opportunistic_locking],
 but frankly, I don't know how reliably this works. I'll give it a go tomorrow 
on the work network.

Can you tell me which version of windows you are running?
                
> 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