NET Logging Library
Logging to a CSV File
Basic Tasks > Logging to a CSV File

The CSV File target automatically defaults to performing in place rolling.  After 10,000 entries are reached, older items will be discarded.  This behavior can be overridden.  The connection to the file will be automatically closed if nothing has been written to the log for one second. 

 

It has these properties that can be configured:

 

//Example runtime configuration, can also use log.config, app.config, or web.config
Log.ResetConfiguration();   
CsvTarget target = new CsvTarget("log.csv");       
Log.Config.Targets.Add(target);

Log.Debug("This is a test");

 

You can specify dynamic paths using these constructs:
 
Data Directory
http://stackoverflow.com/questions/1409358/ado-net-datadirectory-where-is-this-documented
|DataDirectory|\mylogfile.csv

Server.MapPath for ASP.NET, Web Services, and WCF
http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx
Server.MapPath("~/App_Data")\mylogfile.csv

Special Folders
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx
%ApplicationData%\mylogfile.csv
%CommonApplicationData%\mylogfile.csv
%LocalApplicationData%\mylogfile.csv
%MyDocuments%\mylogfile.csv