We can enable error logging and displaying of error message for the VSTO add-in by setting environment variables VSTO_SUPPRESSDISPLAYALERTS and VSTO_LOGALERTS.
To display each error in a message box, set the VSTO_SUPPRESSDISPLAYALERTS variable to 0 (zero). You can suppress the messages by setting the variable to 1 (one). To write the errors to a log file, set the VSTO_LOGALERTS variable to 1 (one). Visual Studio Tools for Office creates the log file in the folder that contains the application manifest. The default name is <Manifestname>.manifest.log.
We can refer to the article mentioned below:
Visual Studio Tools for the Microsoft Office System : Debugging in Application-Level Projects
Starting in Visual Studio 2008 Service Pack 1 (SP1), you can use the event viewer in Windows to see error messages that are captured by the Visual Studio Tools for Office runtime when you install or uninstall Visual Studio Tools for Office solutions. You can use these messages from the event logger to resolve installation and deployment problems.
You can enable the event logger by setting the VSTO_EVENTLOGDISABLED environment variable to “0”.
Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0): Event Logging (2007 System)
We can also use AddinSpy to gather information for troubleshooting
Using AddinSpy and AS Diagnostic Tools for Microsoft Office Add-ins
We can also use VSTO Troubleshooter which is part of VSTO Power Tools. It is a diagnostic tool that examines a computer looking for the necessary prerequisites for running Visual Studio Tools for Office solutions.
Microsoft Visual Studio Tools for the Office System Power Tools v18.104.22.168
We can also have look at some troubleshooting techniques posted by my colleagues: