Logging is a useful and essential part of any application, therefore to get the most benefit from it, it is useful if MicroLite can utilise the same logging framework as your application.

For that reason, MicroLite does not include a specific logging framework, but rather allows any other framework to be used.

This is done by using extension packages, at present there are extension packages for log4net and NLog which are probably the most popular logging frameworks for .net.

Firstly, install the package you need Install-Package MicroLite.Extensions.Log4Net or Install-Package MicroLite.Extensions.NLog.

The extension packages assume that the relevant setup and configuration of the logging framework has been done by the application using it.

Once the package is installed, you simply need to configure the extension:

// Load the extensions
   .WithLog4Net(); // or .WithNLog();

// Create the session factory...

It is recommended that the logging framework is the first extension loaded so that other extensions may also write to the log.

MicroLite will then write to the same log as your application.

This article was written for version 1.2.2 of the MicroLite framework.


One thought on “Logging

  1. Pingback: Creating a custom logging extension | MicroLite ORM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s