Share via

Can we see parameter values for SQL dependency calls?

bitshift 71 Reputation points
2023-04-18T14:46:38.8166667+00:00

Have an asp.net core application that makes EF calls to a SQL database. When I pull in sql dependency calls as part of querying the logs, I see the statement, but any query parameter values are simply the parameterized statements, but I dont see what values were used in the statement. Is there a way to see those?

Azure Monitor
Azure Monitor

An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,336 Reputation points Microsoft Employee Moderator
    2023-04-20T21:49:02.75+00:00

    I'm assuming that you've already enabled database query monitoring and set builder.Services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => { module.EnableSqlCommandTextInstrumentation = true; });

    If so, make sure you have enabled sensitive logging on the DbContext. Also, if I'm not mistaking, when you configure Logging for EF category to Information and lower, then the parameterized value should print out locally. If they print out locally, then that same configuration should trace out logs.

    Should these suggestions not work, please let me know by commenting down below.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.