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

  • Home
  • SEARCH
  • 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 6785479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:07:54+00:00 2026-05-26T17:07:54+00:00

I found a some post about difficulties found on logging sql queries when using

  • 0

I found a some post about difficulties found on logging sql queries when using NHibernate 3.x
Indeed I’m using NHibernate 3.2 and I can’t get the sql logging to work.
I just need the simple logging capabilities that write in the output window when testing or debugging.
It used to work in NH 2.2, but with this new version something is wrong.
As this article says, I simply configured NHibernate with

<property name="show_sql">true</property>

I have this simple code:

using (var session = PersistenceManager.Istance.GetSession()) {
    var result = (from agenzia in session.Query<Agenzia>()
                 select agenzia).ToList();
    return result;    
}

But it seems that nothing is retrieved from the DB. So I don’t know if nothing is logged (I’m debugging under visual studio 2010, so I expect to see something in the output window), or simply nothing is even executed for some strange reason.
There’s no exception anywhere, so I’m a little confused

EDITED:
as requested, this is the complete configuration file for NHibernate:

<?xml version="1.0" encoding="utf-8" ?>
<!-- NHibernate Configuration -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory name="NHibernate.xlns">
    <property name="dialect">
      NHibernate.Dialect.MsSql2000Dialect
    </property>
    <property name="connection.driver_class">
      NHibernate.Driver.SqlClientDriver
    </property>
    <property name="show_sql">true</property>
  </session-factory>
</hibernate-configuration>
  • 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-05-26T17:07:54+00:00Added an answer on May 26, 2026 at 5:07 pm

    the flag show_sql, AFAIK logs on the STDOUT, so it works perfectly in unit test, or console application, but it does nothing if your app is without stdout ( ie winapp or web app ) in such a case you should enable the log NHibernate.SQL in the log4net config ( or in the alternative logger you possibly use). In a web app you can configure a trace appender in order to see the logged query in the trace window of the debugger.

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

Sidebar

Related Questions

I am beginning to work with Symfony, I've found some documentation about inheritance. But
I read some post about ASP.NET MVC application, but I found only article on
I found a post-receive hook for Git after some googling that I use to
Found some old code, circa VS 2003. Now I have just VS 2008 (SP1)
I found some information about this on Scott Hanselmans Blog Does anybody exactly know
i found some articles, some projects to create thumbnail of a video, using ffmpeg.exe,
Found this which may explain some of my problems - MSDN Post I have
I'm now writing my first jQuery Plugin and i found this blog post about
** post was edited, more info below I've just watched two great videos about
Solved using this post: Can you convert an ASP.NET MVC Application to a Web

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.