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

Charles Mack commented on LOG4PHP-196:
--------------------------------------

I am unable to test this until tomorrow but I suspect that is because the file 
is writing such a small amount and opens and closes quickly.

Try swapping:
{code}
for ($i = 0; $i < 100000; $i++) {
    $logger->debug($i);
}
{code}

With this:
{code}
for ($i = 0; $i < 100000; $i++) {  
  $testString = $i . str_pad(" ", 10000, ' ') 
  $logger->debug($testString );
}
{code}

Also, the maxFileSize is set pretty small, meaning the file copying is quick. 
Try 50MB over 100 kbs.   The idea is to "trick" a process to keeping the file 
that is being rolled open.   Now that I that way, it does seem like a pretty 
extreme use case but I would rather 10 50 mb files over several hundred 100kb 
files.

This has been replicated on Windows 7 64-bit and Windows 2003 Server 32-bit.  I 
cannot attest for the current github version though.
                
> 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