Query on File Wrapping

  • Hi ,

    Our application needs to log trace messages to a file for troubleshooting  .

    Currently once the file size reaches 10MB , we are creating a new file and copying the last 4KB messages to the new file.But the requirement is to wrap the file i.e  to always keep the latest 10MB traces.

    Any inputs in this regard.

    Thanks,
    Swetha
  • On Apr 7, 2010, at 11:56 PM, Swetha Chinthireddy wrote:

    > Currently once the file size reaches 10MB , we are creating a new
    > file and copying the last 4KB messages to the new file.But the
    > requirement is to wrap the file i.e  to always keep the latest 10MB
    > traces.

    There isn't any filesystem call to delete bytes from within the file.
    Just create a new file and copy the last 10MB to it. But don't do this
    on every write, of course, because copying 10MB isn't cheap.

    —Jens
previous month april 2010 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today