Profiler does not display sql statement

514 views
Skip to first unread message

Hfern

unread,
Jul 24, 2009, 8:30:23 AM7/24/09
to nhprof, hillary....@sac.com
I downloaded the NHProfiler and have added the reference to my .NET
console application and added the following line within the main
method

HibernatingRhinos.NHibernate.Profiler.Appender.NHibernateProfiler.Initialize
();

The profiler does not log any sql statements.

The client.exe is launched from the same directory as the console
application csproj file is in.


Also the console application has a reference to a custom dll, which
has the Nhibernate code.

Could you please let me know, if there are any steps needed to see the
sql statements

Ayende Rahien

unread,
Jul 24, 2009, 8:45:57 AM7/24/09
to nhp...@googlegroups.com
Just some standard checks:
a) are you using a firewall that can prevent it?
b) are you seeing anything at all in the profiler (sessions, stats)?
c) what is the customer dll that contains NH code?

Hadi Hariri

unread,
Jul 24, 2009, 8:46:00 AM7/24/09
to nhp...@googlegroups.com
What OS are you running? I've ran into this issue with Windows 2008.

2009/7/24 Hfern <hillary....@gmail.com>



--

Blog: http://hadihariri.com
Twitter: http://twitter/hhariri

Hadi Hariri

unread,
Jul 24, 2009, 8:49:18 AM7/24/09
to nhp...@googlegroups.com
In my case,

No. Firewall was off. I could even telnet to the profiler and no couldn't see anything on the profiler.

It was a VM I set up and everything was exactly the same as on my machine except for the OS itself. I'm running Win7. But all other libraries, tools, etc..all same version.

Not sure if it's Win2008 related but it's the only different thing I could think of.



2009/7/24 Ayende Rahien <aye...@ayende.com>

Hadi Hariri

unread,
Jul 24, 2009, 8:50:16 AM7/24/09
to nhp...@googlegroups.com
one other diff, NHProf was running trial under the VM, but doubting that has influence on this :)

2009/7/24 Hadi Hariri <hadi....@gmail.com>

Ayende Rahien

unread,
Jul 24, 2009, 8:52:09 AM7/24/09
to nhp...@googlegroups.com
That is interesting, W2008 is my dev machine, any idea why?

Hfern

unread,
Jul 24, 2009, 9:16:18 AM7/24/09
to nhprof
I am using Windows XP SP2, I am not using any firewall.
The custom dll is built in house handles all the db calls (which
contains the Nhibernate code).
The console application has a reference to it.

Please note that this is a trial version I downloaded.
I see no information for Sessions, or Session Factory Statistics

I see the following in the log.txt
2009-07-24 08:16:04,963 [1] INFO Rhino.Licensing.LicenseValidator
[(null)] - License C:\Documents and Settings\HFERNPC2\Local Settings
\Application Data\NHProf\license.xml expiration date is 08/24/2009
15:59:23

On Jul 24, 8:45 am, Ayende Rahien <aye...@ayende.com> wrote:
> Just some standard checks:a) are you using a firewall that can prevent it?
> b) are you seeing anything at all in the profiler (sessions, stats)?
> c) what is the customer dll that contains NH code?
>
>
>
> On Fri, Jul 24, 2009 at 3:30 PM, Hfern <hillary.fernan...@gmail.com> wrote:
>
> > I downloaded the NHProfiler and have added the reference to my .NET
> > console application and added the following line within the main
> > method
>
> > HibernatingRhinos.NHibernate.Profiler.Appender.NHibernateProfiler.Initializ­e
> > ();
>
> > The profiler does not log any sql statements.
>
> > The client.exe is launched from the same directory as the console
> > application csproj file is in.
>
> > Also the console application has a reference to a custom dll, which
> > has the Nhibernate code.
>
> > Could you please let me know, if there are any steps needed to see the
> > sql statements- Hide quoted text -
>
> - Show quoted text -

Ayende Rahien

unread,
Jul 24, 2009, 9:20:54 AM7/24/09
to nhp...@googlegroups.com
Have you renamed NHibernate's namespace, maybe? Or are you using a custom log4net dll?

Hfern

unread,
Jul 24, 2009, 9:55:41 AM7/24/09
to nhprof
NHibernate namespace is not renamed, and no changes made to the
log4net dll.
The Nhibernate version is 2.0.1.4000
> > > - Show quoted text -- Hide quoted text -

Ayende Rahien

unread,
Jul 24, 2009, 9:58:06 AM7/24/09
to nhp...@googlegroups.com
Hm,
Not sure, then.
Can you try creating a small test project?

Hfern

unread,
Jul 24, 2009, 11:08:32 AM7/24/09
to nhprof
One more thing I forgot to mention, this custom dll is in a WCF
service hosted in IIS, could that be the reason.

On Jul 24, 9:58 am, Ayende Rahien <aye...@ayende.com> wrote:
> Hm,Not sure, then.

Hadi Hariri

unread,
Jul 24, 2009, 11:18:52 AM7/24/09
to nhp...@googlegroups.com
I think Jeremy Skinner reported some issues regarding Win2008 a few weeks back on this group.

2009/7/24 Hfern <hillary....@gmail.com>

Hadi Hariri

unread,
Jul 24, 2009, 11:19:53 AM7/24/09
to nhp...@googlegroups.com
No clue. It was during training so I couldn't do much investigation and this
was on one of the student machines. I've got the VM though so I'll look into
it and see if I can figure out why, but good to know it's not a Win2008
issue.

Jeremy Skinner

unread,
Jul 24, 2009, 11:53:30 AM7/24/09
to nhp...@googlegroups.com
I did indeed (although I'm using Win7 rather than 2008). I posted my workaround here: http://www.jeremyskinner.co.uk/2009/07/21/running-nhibernate-profiler-under-iis7-integrated-mode/

2009/7/24 Hadi Hariri <hadi....@gmail.com>

Hadi Hariri

unread,
Jul 24, 2009, 12:23:08 PM7/24/09
to nhp...@googlegroups.com
Sorry, I meant to say IIS. I'm obsessed with Win2008...

2009/7/24 Jeremy Skinner <jer...@jeremyskinner.co.uk>

Michael Schuld

unread,
Dec 12, 2011, 2:51:09 PM12/12/11
to nhp...@googlegroups.com, hillary....@sac.com, aye...@ayende.com
I am having this same problem trying to upgrade to 3.2.
  • Windows 7
  • IIS 7.5.
  • App Pools are already running as an Administrator account as suggested by Jeremy Skinner.
  • Using web.config method of init.
  • log4net DLL is in the Bin folder
  • log4net version is 1.2.10
  • Session statistics and entity counts are showing in nhprof just not queries
All of this worked with NHibernate 2 and not with 3 now (no other changes). Any ideas?

Fitzchak Yitzchaki

unread,
Dec 13, 2011, 3:24:08 AM12/13/11
to nhp...@googlegroups.com, mikes...@gmail.com
The profiler is working with NHibernate 3.
Can you provide us a sample project that show it fails?

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhprof/-/5BvHGJDiIGgJ.
To post to this group, send email to nhp...@googlegroups.com.
To unsubscribe from this group, send email to nhprof+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.

Michael Schuld

unread,
Dec 21, 2011, 11:59:37 AM12/21/11
to nhp...@googlegroups.com, mikes...@gmail.com
I created a small sample app similar to the one here:  https://docs.google.com/Doc?docid=0AUP-rKyyUMKhZGczejdxeHZfOGMydHNqdGc0&hl=en&pli=1

When running it, the initial table creation query is showing in the profiler, but any data queries are not showing up and the following error is showing in the console:

log4net:ERROR [NHibernateProfilerAppender] Could not create message to send
System.InvalidOperationException: The requested operation is invalid for DynamicMethod.
   at System.Reflection.Emit.DynamicMethod.RTDynamicMethod.get_MethodHandle()
   at HibernatingRhinos.Profiler.Appender.StackTraces.StackTraceGenerator.<SlowAndSafeApproachToGetStackTrace>b__2()
   at HibernatingRhinos.Profiler.Appender.StackTraces.StackTraceGenerator.StackTraceCache.GetStackTace()
   at HibernatingRhinos.Profiler.Appender.StackTraces.StackTraceGenerator.GetStackTrace()
   at HibernatingRhinos.Profiler.Appender.StackTraces.StackTraceGenerator.GetStackTrace(String logger, String message, Level level)
   at HibernatingRhinos.Profiler.Appender.ProfilerIntegration.PublishProfilerEvent(String sessionId, String loggerName, String message, DateTime timestamp, Level level)
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfilerAppender.Append(LoggingEvent loggingEvent)

Michael Schuld

unread,
Dec 21, 2011, 12:07:29 PM12/21/11
to nhp...@googlegroups.com
Here is the sample project code. We use MySQL so you will need to have that set up to run this. Make sure to edit the connection string as well for testing in your local environment.
NHibernate3Sample.zip

Fitzchak Yitzchaki

unread,
Dec 22, 2011, 8:38:03 AM12/22/11
to nhp...@googlegroups.com, Michael Schuld
Please try to update the appender dll.
This seems to solve the issue.

On Wed, Dec 21, 2011 at 7:07 PM, Michael Schuld <mikes...@gmail.com> wrote:
Here is the sample project code. We use MySQL so you will need to have that set up to run this. Make sure to edit the connection string as well for testing in your local environment.

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhprof/-/VudRuCS2dX0J.
Reply all
Reply to author
Forward
0 new messages