Share via


Simple File Log System

The System.IO.Log namespace defines an interface for logging to a record-oriented sequential I/O system. Using the classes from this namespace, you can implement your own diagnostic logging or transaction processing system. The namepsace also provides an implementation of this interface that uses a simple file-based log and an alternative implementation that uses the Common Log File System (CLFS) provided by ws2003r2 and Windows Vista.

System.IO.Log Namespace

The System.IO.Log namespace defines an interface for logging to a record-oriented sequential I/O system. Implementations of this interface can be used to read and write log records. When log records are appended to such an implementation, each one is given a unique sequence number. Sequence numbers are strictly monotonically increasing within a given record sequence, and numbers from different record sequences are not comparable. Sequence numbers are represented by the SequenceNumber structure. In addition, the record sequence provides a mechanism for reserving space in the underlying storage. You can take advantage of this reservation mechanism to ensure that necessary space exists for future log records.

Two different implementations of this interface are provided by the FileRecordSequence and LogRecordSequence classes. The FileRecordSequence is a record sequence based on a single log file in the file system.

The LogRecordSequence class, on the other hand, provides an implementation of the record sequence interface on top of a Common Log File System (CLFS) log. For more information on this implementation, see the "System.IO.Log Abstraction" section.

The FileRecordSequence is a record sequence based on a single log file in the file system. It is a simple implementation of the IRecordSequence interface, on top of a simple file-based log.

To manipulate a file-based log, the account that your application running in must have sufficient privileges, as dictated by the file system security at the time the FileRecordSequence is constructed. In addition, a demand for FullTrust is made at construction time. The permission verification results are cached thereafter in keeping with the Windows security model. You should ensure that you do not accidentally expose the contents of the record sequence to an unauthorized user.

See Also

Concepts

Common Logging File System

Footer image

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation. All rights reserved.