You are here: Re: Trimming a large log file? « PHP Programming Language « IT news, forums, messages
Re: Trimming a large log file?

Posted by mouse on 11/30/06 20:31

In article <waDbh.1716$s04.10@fe78.usenetserver.com>, dta@e3ft.com
says...
> "David T. Ashley" <dta@e3ft.com> wrote in message
> news:giCbh.3572$xf7.2887@fe81.usenetserver.com...
> > The solution you proposed above probably has race conditions.
> > Specifically, if a log entry is made (by another process) at the points
> > I've marked with an asterisk above, you will lose some lines from the log
> > file.
>
> Also, if you're seeing this problem for the first time, this might help:
>
> http://en.wikipedia.org/wiki/Race_condition
>
> The operating system will assign CPU time to processes in unpredictable
> patterns, so if one process stops running and the other goes at the points
> I've marked with an asterisk ...
>
> The "mv" solution is robust because Unix was designed that way ... the
> solution you proposed probably has a race conditions that may cause log file
> lines to be lost.
>
>
>
>

pseudocode
start
If filesize > 2Mb rename log.txt log.bak
end;

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация