Continuing my current mission to NuGet-ify my current utility libraries, and building on my Introducing Caliburn.Micro.Logging post, I have now released Caliburn.Micro.Logging.log4net which integrates log4net into Caliburn.Micro. There were no code changes to this from the code in my earlier post How To Do Logging with Caliburn.Micro, so it should be very easy to migrate to the NuGet package.
How to Use Caliburn.Micro.Logging.log4net
Using NuGet for Caliburn.Micro.Logging.log4net
The NuGet package id is Caliburn.Micro.Logging.log4net. So you can install the package from the NuGet package manager shell using the following command:
or if you are more GUI minded, use the Add Package Reference dialog.
Getting the Code for Caliburn.Micro.Logging
You can find the code for Caliburn.Micro.Logging on github at https://github.com/dbuksbaum/Caliburn.Micro.Logging.
Configuring Your Code to use Caliburn.Micro.Logging.log4net
Once you have added the Caliburn.Micro.Logging.log4net NuGet package to your project, just modify the bootstrapper by adding a static constructor that sets the GetLog delegate.
static AppBootstrapper()
{
LogManager.GetLog = type => new log4netLogger(type);
}
That is the only change to complete integration, but log4net still has some required configuration. Check out my earlier post How To Do Logging with Caliburn.Micro to see what you need to do if you are unfamiliar with log4net.
Summary
The small refactoring done in Caliburn.Micro.Logging has made the creation of this package trivial. I hope you find it as useful as I do.
In the meantime, if you have suggestions, comments, or critiques, please add a comment below, add an issue to the issue tracker, or send me email using the blog comment form.