Logging Mechanism using memory mapping technique

Posted by Tushar on Stack Overflow See other posts from Stack Overflow or by Tushar
Published on 2009-11-25T09:13:24Z Indexed on 2010/04/18 5:03 UTC
Read the original article Hit count: 365

Filed under:
|

Just create a mapping of the file of the required size (CreateFileMapping or mmap), write the lines in the buffer and start over when the maximum number is reached. -- Your answer for write-a-circular-file-in-c.

I am also writing the LogWriter module. In this caase i am mapping the whole file to the memory using mmap().

I am maintaining the Read and Write pointers.I want to write the log to the file in append mode. Then when logger service is started first time it writes it appends the logs. But when system gets shutdown next time when i run the service it doesn't append the data at the end. I want to maintain the write and read offsets even if system shut down.How to achieve this ..?

How to find the how much data is written to the log file. ??

© Stack Overflow or respective owner

Related posts about c++

Related posts about logging