Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:39:26+00:00 2026-06-05T15:39:26+00:00

I remember the days (not too long ago, really) when log4net came along with

  • 0

I remember the days (not too long ago, really) when log4net came along with NH and was compulsory for the OR-Mapper. Nowadays it isn’t compulsory anymore, but optional.

I really wonder how this is achieved by NHibernate. If anyone could explain in a few words, that would be highly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:39:27+00:00Added an answer on June 5, 2026 at 3:39 pm

    NHibernate has an ILoggerFactory to create the logger defined as below:

    public interface ILoggerFactory
        {
            IInternalLogger LoggerFor(string keyName);
            IInternalLogger LoggerFor(System.Type type);
        } 
    

    The IInternalLogger interface, that depites the name is not internal at all, is the actual logger interface, that non surprisingly map exactly the ILog interface of log4net. NH internally ask logger factory when it needs to log. If no other logger is configured, and log4net assembly is present, the factory return a wrapper around log4net. If you want provide your own you just need to provide a logger factory and configure it as:

     <appSettings>
            <add key="nhibernate-logger" 
                      value="MyLoggingLoggerFactory, MyLoggingAssembly"/>
        </appSettings>
    

    As you guess, the class MyLoggingLoggerFactory must implement ILoggerFactory. The returned loggers of course must implement IInternalLogger, that as said before is public even if the unhappy name can be misleading.
    This is the startegy they use to be log4net independent. As an addition, if you don’t want log at all, just remove the log4net assembly from your deploy directory: NH will degrade gracefully and use internally a null logger.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if this is an appropriate forum to ask as this isn't really
I remember the days of Shadowrun that got me excited about hacking. There is
In my college days I remember a php code that handles errors like this..
I remember a few months ago finding a very short (three methods, IIRC) but
I remember reading something once, but could not find it now while searching, if
First: sorry for my poor English writing. I remember that in VB6.0 days, we
I just started learning Python a couple of days ago as my first language
I am using jQuery-1.4.2 with CakePHP and a few days ago I had this
I remember in the early days of the web, there were books that included
they keep chaning the firebug UI like ever week these days and I not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.