How can I log the SQL Query to AI?

与世无争的帅哥 提交于 2019-12-10 23:07:16

问题


I have set up a console application that sends data to Application Insights. I can successfully see alot of dependency calls to sql server, but no T-SQL query. Is there any way to configure this?

EDIT: I use Linq to SQL (DBML) to connect to SQL server.

Thanks, Christopher


回答1:


I had the exact same problem and was able to fix it by installing the Application Insights Monitor on our VM that runs IIS and hosts the web application. I found the necessary information here: https://azure.microsoft.com/en-us/documentation/articles/app-insights-monitor-performance-live-website-now/

You can download the Application Insights Monitor from this link: http://go.microsoft.com/fwlink/?linkid=506648&clcid=0x409

After installing and running this application you will be prompted to add your application pool identity user to the "Performance Monitor Users" security group in Windows. You can find the exact username to add in the warning message that you see in the Application Insights Monitor. You will also be prompted to restart your IIS for the changes to take effect.

In my case I also added the Application Insights SDK to my web application to get best of both worlds (as described in the link above).

I hope this also solves your problem.




回答2:


I believe the SQL Query should be logged in the details of the dependency call item in the Command property. Have you looked at that part?




回答3:


You should try using .NET 4.6, we contributed some code that allows us to capture this information



来源:https://stackoverflow.com/questions/33101685/how-can-i-log-the-sql-query-to-ai

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