SQL Query Monitoring

I know there are query monitoring tools from different database providers but I was wondering if there was a way to log/print all the queries requested by Ignition to any database connection. May be something within system.db ?

You can turn the loggers Gateway.Database.Updates and Gateway.Database.Selects to TRACE and you’ll see every statement we’re issuing.

3 Likes

Awesome,

That worked great.

Just a quick ask, is it possible to filter through the Property ? I want to look for only one database connection. When I put that in filter, doesn’t seem to really work.

You could set a filter for the database MDC context key to trace for your particular DB connection name:

2 Likes

Oops missed that.

To that, I did gave a shot but still shows up all the queries (the tag history data covers more or less the whole page and its annoying)

Yes. Tag history issues a lot of queries. I’m not sure what you expected the output to be?

I was hoping to print the queries related to LoMOS database.

Oh, I see. You did reset the logging levels on the ‘Loggers’ tab? :grimacing:
If you did that, then I have the same assumption for the behavior here, and if that’s not working then it might just be a bug.

No, I didn’t but I think I know what I did wrong. When I used MDC filter, it does work. But, If I use the normal Context filter beside logger settings, that doesn’t work.
May be that’s how it supposed to be ?