SQL: How to log (slow) queries in the system log
SQL logging is usually controlled via the configuration file of NaviServer. However, it can be as well activated at runtime via ds/shell by using the following commands:
- make sure to turn sql-debugging level on
- make sure, the logminduration is small enough (NaviServer allows to log only entries a threshold)
ns_logctl severity "Debug(sql)" on foreach pool [ns_db pools] {ns_db logminduration $pool 0}
If you are interested e.g. in queries taking longer than 0.5 seconds, you can use
foreach pool [ns_db pools] {ns_db logminduration $pool 0.5}