NHibernate monitor connections
Is there a way to monitor the round-trips to the database in an NHibernate application? I need just a log t开发者_StackOverflow中文版o see when NHibernate connects to database.
Have a look at NHibernate Profiler (NHProf) if you don't mind a commercial product. Some of its features are:
- Visual insight into the interaction between your database and application code.
- Analysis and detection of common pitfalls when using NHibernate.
- Analysis is delivered via perfectly styled SQL and linkable code execution.
- Supports NHibernate (.NET) and Hibernate (Java).
You can 'monitor' via logging using NH's log4net. Some useful info here.
That will be monitor from the application side.
Have you tried monitoring from the DB serverside? E.g. enable logging at the say mySql.
In addition to NHProf and log4net, there is also a "show_sql" config entry that will dump the SQL to the console in a console app.
Your database vendor should also have tools for monitoring the SQL that is being run against it.
精彩评论