The task_logs
routine returns a list of
logs associated with a task.
The application-level variant for this routine is
app_task_logs
.
This topic contains the following sections:
mysql> SELECT mysql_tasks.task_logs(
IN 'task_id' VARCHAR(36),
IN 'newer_than_log_time' TIMESTAMP(6));
Following are task_logs
parameters:
task_id
(VARCHAR(36)): specifies the unique task ID (UUID
) of the task whose log entries are required.newer_than_log_time
(TIMESTAMP(6)): all the log entries created after the given timestamp are included. If the value isNULL
, all the log entries for a given task ID are displayed.
mysql> SELECT JSON_PRETTY(mysql_tasks.task_logs(@task_id, '2025-06-26 10:00:00'));
The output is similar to the following:
| [
{
"id": "4d7dcd7a-5298-11f0-bca4-020017205654",
"data": null,
"status": "SCHEDULED",
"message": "Task created by user.",
"task_id": "4d7bf6ec-5298-11f0-bca4-020017205654",
"log_time": "2025-06-26 14:17:33.708391",
"progress": 0
},
{
"id": "4d7e5319-5298-11f0-bca4-020017205654",
"data": null,
"status": "RUNNING",
"message": "Event execution started...",
"task_id": "4d7bf6ec-5298-11f0-bca4-020017205654",
"log_time": "2025-06-26 14:17:33.711716",
"progress": 0
},
{
"id": "507a49ad-5298-11f0-bca4-020017205654",
"data": {
"Async Task completed at": "2025-06-26 14:17:38.000000"
},
"status": "COMPLETED",
"message": "Execution finished.",
"task_id": "4d7bf6ec-5298-11f0-bca4-020017205654",
"log_time": "2025-06-26 14:17:38.718451",
"progress": 100
}
] |
This example retrieves the logs added for the task ID
stored in the session variable @task_id
after 2025-06-26 10:00:00
.