$CFG->logsql in config.php not working

$CFG->logsql in config.php not working

от Kathrin Osswald -
Количество ответов: 4

Hi there,

I enabled the line above in the config.php, but there is no table adodb_logsql created in the db. I also tried it and crated the table myself, but no data is written to it.

We use a postgres database. Are there any issues known that it does not work with this kind of database?

I think it's hardly possible to use this code in a wrong way, but maybe I made something wrong, although?

Is there an alternative to the method I tried to use?


Thanks in advance and best regards

Kathrin

В ответ на Kathrin Osswald

Re: $CFG->logsql in config.php not working

от Darko Miletić -
Изображение пользователя Core developers Изображение пользователя Moodle HQ Изображение пользователя Plugin developers

That is no longer used afaik. Moodle does not use AdoDb for quite some time. I'm not sure replacement db logging exists any more.

I would suggest to enable postgresql query log and use that instead.


В ответ на Darko Miletić

Re: $CFG->logsql in config.php not working

от Kathrin Osswald -

Hi Darko,

thanks for your answer!

I created an issue in Moodle Tracker that this code snippet should be deleted from config-dist.php.


As I don't have access to the log-files of the database, I managed to get the statements via the PHP function file_put_contents.


Best reagards,

Kathrin

В ответ на Kathrin Osswald

Re: $CFG->logsql in config.php not working

от Marina Glancy -
Изображение пользователя Core developers Изображение пользователя Moodle Workplace team Изображение пользователя Peer reviewers Изображение пользователя Plugin developers Изображение пользователя Testers

Thanks Kathrin, we'll fix it in config-dist.php (btw, the mentioned issue number is MDL-49276)

In order to log all your sql queries you need to add to config.php:

$CFG->dboptions = array (
  // ... leave whatever is already there in config.php
  'logall' => true,
);

All queries will be logged in table mdl_log_queries

But please note that it will make site very-very slow and can be used termporarily for debugging only.

Alternatively you can specify

'logslow' => true,

to log only slow queries (also for debugging)