-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Retrieve Logs from %temp%\OfficeAddins.log.txt and Display Them in the Side Panel of an Excel Add-In #5238
Comments
For your add-in, logging directly to the browser console using console.log() or similar commands is an ideal solution for diagnostic purposes. This method is quick to implement, doesn’t require extra setup, and provides immediate access to logs during real-time debugging. While the logs won't persist after the browser or add-in is closed, persistence isn’t necessary for diagnostics since the logs are only needed temporarily to troubleshoot issues. Users can easily access the logs through the developer tools, making this approach both simple and effective for your needs. |
I believe your issue has been resolved so I'll go ahead and close this issue for now, but please don't hesitate to reopen it or create a new issue if you have further questions or need additional assistance. Have a great day! |
Hi @guoms1 I’m familiar with this approach, but I need to fetch runtime logs generated during function calls. I know that when the Office Add-in runs in a browser, these logs can be viewed in the console pane. However, how can I access or fetch these logs when running the add-in in the desktop Excel application?
|
Hi @KishanVaishnani, Thank you for your follow-up question. When your Office Add-in is running in the desktop version of Excel, it is still effectively hosted in a browser environment under the hood (e.g., WebView2 for modern Office versions). This means that you can access the same debugging tools to view logs as you would in a standard browser. To enable and open the debugging tools in the desktop Excel application, follow these steps:
This allows you to access runtime logs for troubleshooting, whether the add-in is running in the browser or desktop version of Excel. If you need further assistance, feel free to reach out! |
Hi @guoms1 I’m not sure if you’re aware, but this will only work if you have the task pane add-in. I have a custom function for my Excel add-in that runs independently of the task pane. It executes directly within the Excel sheet. So, I need to fetch the runtime logs of custom functions executed directly within the Excel sheet For more information about custom functions in Excel add-ins, you can check this link: Custom functions. My issue is still not resolved. Please reopen it. |
Reopen the issue as @KishanVaishnani mentioned it not resolved yet. |
Apologies, I didn’t realize the issue was related to custom functions. Have you had the chance to try the followings: |
I think these two parts should be the most relevant to your interest. If they don’t fully address your question, please feel free to let me know! Debugging custom functionsTo debug custom functions add-ins that use a shared runtime, see Overview of debugging Office Add-ins. To debug custom functions add-ins that don't use a shared runtime, see Custom functions debugging. Enable runtime loggingIf you're testing your add-in in Office on Windows, you should enable runtime logging. Runtime logging delivers console.log statements to a separate log file you create to help you uncover issues. The statements cover a variety of errors, including errors pertaining to your add-in's manifest file, runtime conditions, or installation of your custom functions. For more information about runtime logging, see Debug your add-in with runtime logging. |
Hello @guoms1 No problem! Yes, I am following this in the development environment. However, how do we troubleshoot custom function errors in the production environment that actual customers are using? Currently, we are asking customers to provide logs from the %temp% directory, but this is not an ideal approach, especially since 50+ clients are using this add-in. I hope my issues are clear and easy to understand for everyone |
If you’re looking to troubleshoot issues faced by end users, the most effective method is to use server-side logs. This involves configuring your client application to upload logs to the server and including details to differentiate logs from various clients. While this is outside the scope of Office.js, one possible approach is to use Azure Application Insights if your web application is hosted on Azure. This tool provides built-in logging capabilities that can help streamline troubleshooting. That said, most other infrastructures also offer similar mechanisms, so you’re not limited to Azure. Please note, this is simply a suggestion based on common practices and not an endorsement or promotion. I hope this information is helpful and assists you in resolving your issue. |
Okay, @guoms1 . Thanks for the explanation. I’ll try to capture the logs and send them to the server side. I have the answer now, and you can close this issue |
I have developed an Excel add-in that provides product live pricing using custom streaming functions. The office add-in javascript-only function is designed to log errors in a file located at %temp%\OfficeAddins.log.txt. To help troubleshoot customer issues more effectively, I want to retrieve the logs from this file and display them in the side panel of the add-in.
(My custom functions runs without side panel)
Key Requirements:
Access the %temp%\OfficeAddins.log.txt file programmatically
Read the log file contents
Display the logs in the side panel UI of the add-in, allowing users to view error details for troubleshooting purposes
Questions:
The text was updated successfully, but these errors were encountered: