The 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:
LogFilePath - The path to the log file
//Example runtime configuration, can also use log.config, app.config, or web.config
Log.ResetConfiguration();
FileTarget target = new FileTarget("log.txt");
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.txt
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.txt
Special Folders
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx
%ApplicationData%\mylogfile.txt
%CommonApplicationData%\mylogfile.txt
%LocalApplicationData%\mylogfile.txt
%MyDocuments%\mylogfile.txt