Cadence.NET has logging implemented in it via Log4Net.

In order to activate Cadence's logging mechanism, you will need to configure a few things.

First, add a reference to the included log4net binary.

From within your Windows service application, in your AssemblyInfo.cs file, add the following:

[assembly: log4net.Config.XmlConfiguratorAttribute(Watch = true)]

Next, if you don't already have an App.config file, add one, and in it, add the configuration section for log4net:

    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>

Finally, add the types of appenders you'd like to use. This example uses a log file. There are several different appenders you can configure, and they are defined here.

    <level value="DEBUG"/>
    <appender-ref ref="LogFileAppender"/>
  <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="log4net\log.txt"/>
    <param name="AppendToFile" value="true"/>
    <rollingStyle value="Size"/>
    <maxSizeRollBackups value="10"/>
    <maximumFileSize value="10MB"/>
    <staticLogFileName value="true"/>
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%-5p%d{yyyy-MM-dd hh:mm:ss} - %m%n"/>

You're done! Cadence.NET will log to your Debug/bin/log4net/log.txt file (or Release if you are in release mode).

Last edited Sep 19, 2013 at 5:53 PM by Usualdosage, version 1