Logging

Simol sends all logging calls through the .NET Commons Logging API. This is a thin wrapper library that allows you to easily redirect log output to any of the popular logging frameworks available for .NET.

Console And Trace Logging

Simol releases include the core commons logging assembly (Common.Logging.dll), which supports logging to System.Console.Out or System.Diagnostics.Trace. To see Simol log output you must configure the commons logger in your application configuration file. Here's an example that shows how to configure the commons console logger:

<configuration>
    <configSections>
        <sectionGroup name="common">
            <section name="logging"
                     type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
        </sectionGroup>
    </configSections>
    <common>
        <logging>
            <factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
                <arg key="level"
                     value="DEBUG" />
                <arg key="showLogName"
                     value="true" />
                <arg key="showDataTime"
                     value="true" />
                <arg key="dateTimeFormat"
                     value="yyyy/MM/dd HH:mm:ss:fff" />
            </factoryAdapter>
        </logging>
    </common>
</configuration>

Other Logging Frameworks

To use other logging frameworks you must complete the following steps:
  1. Download the 2.0 Commons Logging distribution.
  2. Add the appropriate Commons Logging assembly to your application (e.g. add Common.Logging.Log4Net.dll if your application uses Log4Net).
  3. Update your application config file to use the desired logging framework. See the Commons Logging documentation for detailed instructions.

Last edited May 24, 2011 at 12:51 PM by ashleytate, version 6

Comments

No comments yet.