当我尝试从外部数据库日志中提取时,Moodle 实时日志中的 "dmlreadexception" 错误意味着什么?有什么建议可以解决吗?

What does the "dmlreadexception" error mean on Moodle live logs when I try to pull from an external db log? And any suggestions to fix?

我正在尝试使用 Moodle 中的外部数据库日志插件将标准日志 table 复制到外部数据库中,以便更轻松地进行一些分析工作。

我激活了外部数据库日志并在设置页面上添加了所有正确的设置。我点击“测试连接”,它连接成功,并成功返回table列headers。但是如果我四处点击并制作一些日志,它们在标准日志存储中是可见的,但我的外部数据库 table 仍然是空的。

所以我尝试使用与我在外部数据库日志存储设置中输入的相同凭据在 TablePlus 中本地连接到我的外部数据库,并且我可以成功连接和写入。

接下来我进入实时日志并选择标准日志,它们显示得很好。然后我点击外部数据库日志(除了 2 行手动输入的数据外什么都没有),并得到这个错误:

URL: https://ohsu.mrooms3.net/
Debug info: ERROR: syntax error at or near "{" LINE 1: SELECT COUNT('x') FROM {OpenLMSLog} WHERE courseid =  AND ... ^ SELECT COUNT('x') FROM {OpenLMSLog} WHERE courseid =  AND timecreated >  AND anonymous =  [array ( 0 => '1', 1 => 1604556625, 2 => 0, )] Error code: dmlreadexception
Stack trace:
 * line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
 * line 329 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
 * line 920 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
 * line 1624 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
 * line 1697 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
 * line 1912 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
 * line 1895 of /lib/dml/moodle_database.php: call to moodle_database->count_records_sql()
 * line 262 of /admin/tool/log/store/database/classes/log/store.php: call to moodle_database->count_records_select()
 * line 329 of /report/loglive/classes/table_log.php: call to logstore_database\log\store->get_events_select_count()
 * line 48 of /report/loglive/classes/table_log_ajax.php: call to report_loglive_table_log->query_db()
 * line 59 of /report/loglive/classes/renderer_ajax.php: call to report_loglive_table_log_ajax->out()
 * line 462 of /lib/outputrenderers.php: call to report_loglive_renderer_ajax->render_report_loglive()
 * line 53 of /report/loglive/loglive_ajax.php: call to plugin_renderer_base->render()

这是我在开发人员设置中打开调试后收到的唯一错误消息。我的目标是成功配置外部数据库来跟踪日志,但由于在测试连接时缺少错误消息,因此很难调试。

环境配置:打开LMS 3.8 MP2 (Build: 20201008) 外部数据库是一个 postgres 数据库,所以我们将它设置在 postgres driver.

看起来外部数据库日志存储插件使用的 SQL 与 Postgres 不兼容,尽管在外部数据库日志存储插件设置中使用了 Postgres 驱动程序,如“{”错误所示在问题中显示的 SQL 中。 See here for documentation.

为了解决这个问题,我们使用 MariaDB 而不是 Postgres,并且最终让外部数据库日志存储正常工作。

另外请注意,您必须将您的列和数据类型与 Moodle 数据库中的模式完全匹配,然后您必须将数据库的 ID 列设置为自动递增 table。如果您不知道架构是什么样子,“报告”下有一个管理 SQL 界面,可让您 运行 SQL。在侧面,有一个按钮可以查看数据库中任何 table 的架构。