Debugging the OneNote API? Enable logging!

Debugging the OneNote API? Enable logging!

Rate This
  • Comments 5

One new feature in the RTM version of OneNote 2007 is the ability to enable logging for the OneNote API such that you can see what is going wrong and get some debug information from OneNote. Some notes:

  1. If you turn on logging make sure to TURN it OFF after you are done debugging your app.
  2. You cannot get any more information other than what you get from the debugging output.
  3. It works for toolbar addins as well as calls via the COM API.

To enable logging you will need to turn on some registry keys, here is the .reg file:

-------------------------------

Windows Registry Editor Version 5.00 

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\OneNote\Options\Logging]

"EnableLogging"=dword:00000001

"65815"=dword:00000001

"65816"=dword:00000001

-------------------------------

Please copy the text above, open Notepad and paste it in there. Then save the file as EnableOneNoteAPILogging.reg. After you have saved the file run it so that this is added to your registry.

Whenever you make calls to the API OneNote will append logging information to %temp%\OneNote.log which allows you to see what is going wrong with your code and help you debug. Afterwards open regedit and change the EnableLogging key to 0 which will turn it back off.

 

Update for OneNote 2010 @ 2010.03.15:

If you are trying to do this with OneNote 2010 the values in the registry changed and it should be this:

[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\OneNote\Options\Logging]

"EnableLogging"=dword:00000001

"ttidLogObjectModel"=dword:00000001

"ttidLogObjectModelAddins"=dword:00000001

 

I just wanted to let you all know, if you have questions please email or comment.

Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post
  • Regarding OneNote 2010 use (on Win7), it doesn't seem to be creating the log file ('Windows cannot find...') even when I purposely create OneNote API exceptions (e.g. COM Exception 0x80042001 (Invalid XML)).

    Doesn't it save such events or am I doing something wrong?

  • I'm using OneNote2010, and I had to create:

       "EnableTextFileLogging"=dword:0000001

    to get the OneNote.log file.

    It still isn't much use though ;-).  I can't work out whether I'm an idiot, or the OneNote API is confusing/incorrect.

    I'm trying to create the hierarchical structure of SectionGroup->Section->Page.  But each seems to need a completely different way of massaging the API.

  • @RichS: Thanks for the tip regarding 'EnableTextFileLogging'. Logging is now working!

  • There is almost zero documentation on how OneNote actually works, how to automate it from Excel, Word - other office apps, no object model reference -- nothing.  I am dumping it.

  • this works wonders for the 2007/2010 versions; any idea on how to enable logging on 2013 edition?

    The registry doesn't seem to have any entries concerning loggin at all.

    The only folders located under 'Options' are Paths, Pen and Save (so, no logging).

    It's been  7 years since you posted this and it is still one of the few places that even has some sort of information regarding this subject.

    Thanks anway!

Page 1 of 1 (5 items)