6

Can anyone help me with enabling ODP.Net logging on a Windows XP machine? I googled and found following link but it did not work for me.

http://download.oracle.com/docs/html/E10927_01/featConfig.htm

I set the "TraceLevel" setting to "63" in registry but it did not help

Basically I want to capture all the database call happening from my C# code through the log.

I wish there was a tool like "SQL Profiler" for Oracle.

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
Viren Jhala
  • 61
  • 1
  • 2
  • Have you followed the directions to configure ODP.net? This simple sounds like a configuration problem. Start from the begining it should work then. – Security Hound May 06 '11 at 18:34
  • not sure what do you mean by configuring odp.net? It is installed, configured and working perfectly for my application. I just want to add some logging/tracing which I tried by making some registry changes as suggested in the odp.net support document but it did not generate any trace file. – Viren Jhala May 06 '11 at 18:38
  • Viren, this document **is** good and ODP logging **does** work - I did this myself only last week. Suggest you check that you're modifying the right hive, perhaps? – PeteH May 25 '11 at 16:32

3 Answers3

3

Note that the trace will default to go in the root of the C drive. For Windows 7 and later, this requires administrator privilege or it will just fail silently. So either make sure your app is running as administrator or that you change the path of the file.

Also note, that if you want to trace ODP.NET fully managed, you need to put the settings inside the app or web config file, not the registry, AND the settings for TraceLevel are different (1 through 7).

And finally, when tracing unmanaged ODP.NET remember that there is a separate WOW registry node for 32 bit Windows. If your app is 32 bit, don't accidentally set it under the 64 bit portion of the registry.

Christian Shay
  • 2,570
  • 14
  • 24
3

I had the same issues on certain machines when troubleshooting some issues with Oracle Support. I found that changing the path to the output file a couple of times and multiple restarts finally forced the ODP client to start logging. Make sure that the output file is to a directory that your calling application identity has access to.

Check the following things in the registry keys. Here is an example from my machine for .net4 and 11.2.

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE\ODP.NET\4.112.2.0

  • 32 or 64 bit (correct node)
  • Change the Trace Level to 8 (or 64 I think for complete logging)
  • Change the Trace Option = 1
  • Set a valid TraceFileName
tsells
  • 2,751
  • 1
  • 18
  • 20
  • 1
    Useful: ***http://blogs.msdn.com/b/biztalknotes/archive/2013/03/14/collecting-troubleshooting-data-for-wcf-oracle-adapter.aspx*** and ***http://blog.ilab8.com/2011/09/02/odp-net-pooling-and-connection-request-timed-out*** and Best practices `https://nvtechnotes.wordpress.com/2009/04/13/oracle-data-provider-for-net-best-practices` – Kiquenet Nov 27 '15 at 10:29
  • make sure the process has write access to the path. Also recycle/restart the application(pool). – Koen van der Linden Nov 07 '17 at 08:03
-2

You can also use AOP-based approach - generate proxy using library like Castle Dynamic Proxy, intercept the calls you're interested in and log the arguments like SQL and parameters. This is more powerful method in my opinion although it can somehow affect performance. See this Gist for sample implementation: https://gist.github.com/Buthrakaur/b1124c08f8521f39f8fd

Buthrakaur
  • 1,821
  • 3
  • 23
  • 35