Console log in Javascript Office Addin

一曲冷凌霜 提交于 2019-11-29 17:50:26

问题


I have a question about "console.log" in Javascript Web Office Addins. Currently I am working on Javascript Word Addin and can't troubleshoot it, because I don't understand where the "console.log" output is sent. On Microsoft site there are a lot of examples, that contain contain "console.log", but they never specify how to check these outputs.

So, the question is how can I see this "console.log" output. I am not using Visual Studio.

BR, Alexey


回答1:


When you say you're not using Visual Studio, do you mean that you're not using the Visual Studio template? Or that you physically don't have Visual Studio on the machine (if so, might I recommend you install it -- even just the free/community edition)?

Once you have that:

  • Close all instances of Internet Explorer
  • Go to Visual Studio -> Debug -> Attach to process
  • Be sure to select "Attach to": "Script code"
  • Select all the iexplore.exe instances
  • Click "Attach"

You should now get a full debugging experience, complete with console output ("JavaScript console" window; use the Quick Launch (ctrl-Q) to launch it if it doesn't display be default), DOM Explorer (again, use Quick Launch if you don't see it), and more.

~ Michael Zlatkovsky, developer on Office Extensibility team, MSFT




回答2:


There is an alt way if you don't have Visual Studio. There is a tool in windows name is 'F12 Chooser', you can find it at Windows\SysWOW64\F12\F12Chooser.exe

More info can be found at: https://github.com/OfficeDev/office-js-docs/blob/master/docs/testing/debug-add-ins-using-f12-developer-tools-on-windows-10.md




回答3:


In Mac you can use Safari Web Inspector as it is explained here:

https://docs.microsoft.com/en-us/office/dev/add-ins/testing/debug-office-add-ins-on-ipad-and-mac

In Windows is possible to just attach a debugger to the add-in:

https://docs.microsoft.com/en-us/office/dev/add-ins/testing/attach-debugger-from-task-pane




回答4:


I don't know if this option is available on free versions of Visual Studio, but with licensed VS 2015 I solved with a simple window:

(after starting the project) Debug > Windows > JavaScript Console



回答5:


To view the logs generated by office add-ins, you need to use the webservice of the application you are using e.g Excel, Outlook etc. All you need to do is to upload the manifest.xml file as an addin on the web and then it will automactically sync or update when you make changes to your local files.



来源:https://stackoverflow.com/questions/37165316/console-log-in-javascript-office-addin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!