There is a program which keeps on writing in a log file at a very fast rate. The rate is so fast that the file reached 250 MB in just 30 seconds. In perl script I want to write a program which rotates this file. i.e. when ever the size of this file reaches 100 MB, I want to flush all contents of this file and write in log_001.log so that all size remains 100 MB.
Problem is when I rename the file, the file stops writing (may be due to file pointer being destroyed). What is the best possible thing that can be done here.
I want the program to be efficient so that not too much of memory is being used as well.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|