This project is read-only.

File Writer

Class names

Writer: NSoft.Log.Writers.File.FileLogWriter.
Configuration: NSoft.Log.Writers.File.FileLogWriterSettings.


This writer stores data to file system.
Each channel will be mapped on file, which will be recreated in configurable period.
Mappings can be configured in writer settings.

Available settings:
  • DataDelimeter - char or string that used as delimeter for stored data. Default value - Tab (\t).
  • ChannelFileTemplate - template for file name. It is used for all channels that does not have specific mapping. In the template you can use special parameters:
    • {ChannelName} - will be replaced with name of the channel.
    • {TimeStamp} - will be replaced with current ticks.
  • OutputDirectory - path to directory where files should be created.
  • RecreateTime - period of working files recreation. Measured in milliseconds. Default value - 10 minutes.
  • Mappings - special mappings configuration. Mapping value - special file name template.

Configuration samples.

For example we define two channels:
  • Information - channel for some information messages.
  • Exception - channel for errors information.

We want write data from Information channel to file Info.<FileCreateTime>.log.
Other files should have file name like <ChannelName>.<FileCreateTime>.log.
Also we want to move log files, so they should be recreated periodically.

There is configuration:
<add id="1" type="NSoft.Log.Writers.File.FileLogWriter, NSoft.Log.Writers" configurationType="NSoft.Log.Writers.File.FileLogWriterSettings, NSoft.Log.Writers">

      <add channelName="Information" value="Info.{TimeStamp}.log"/>

Last edited Mar 31, 2011 at 9:20 PM by Tesh, version 5