O'Reilly logo

NHibernate 3.0 Cookbook by Jason Dentler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring NHibernate logging

NHibernate uses log4net, a highly customizable, open source logging framework. In this recipe, I'll show you a simple log4net configuration to log important NHibernate events to the Visual Studio debug output window.

Getting ready

Complete the earlier Configuring NHibernate with App.config recipe.

How to do it...

  1. Add a reference to log4net.dll from the NHibernate download.
  2. Open your application configuration file.
  3. Inside the configSections element, declare a section for the log4net configuration:
    <section name="log4net"
    type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  4. After the hibernate configuration element, add this log4net configuration:
    <log4net> <appender name="trace" type="log4net.Appender.TraceAppender, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required