The app_task_logs
routine returns a list
of logs associated with an application-level task.
This topic contains the following sections:
mysql> SELECT mysql_tasks.app_task_logs(
IN 'app_user_id' VARCHAR(255),
IN 'task_id' VARCHAR(36),
IN 'newer_than_log_time' TIMESTAMP(6));
Following are app_task_logs
parameters:
app_user_id
VARCHAR(255): specifies the application-managed user ID of the user who owns the task.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 specified timestamp are included. If the value isNULL
, all the log entries for the specified task ID are displayed.
mysql> SELECT JSON_PRETTY(mysql_tasks.app_task_logs('app_user_01',@task_id,'2025-07-02 10:00:00'));
The output is similar to the following:
| [
{
"id": "a51885db-574c-11f0-9604-020017205654",
"data": null,
"status": "SCHEDULED",
"message": "Task created by user.",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:34.746672",
"progress": 0
},
{
"id": "a5198943-574c-11f0-9604-020017205654",
"data": null,
"status": "RUNNING",
"message": "Event execution started...",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:34.753164",
"progress": 0
},
{
"id": "a51a219f-574c-11f0-9604-020017205654",
"data": {
"connection_id": 1651
},
"status": "RUNNING",
"message": "Progress monitor started.",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:34.757277",
"progress": 0
},
{
"id": "a51aad03-574c-11f0-9604-020017205654",
"data": {
"iteration": 1
},
"status": "RUNNING",
"message": "Progress update",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:34.760739",
"progress": 20
},
{
"id": "a5b3d539-574c-11f0-9604-020017205654",
"data": {
"iteration": 2
},
"status": "RUNNING",
"message": "Progress update",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:35.764511",
"progress": 40
},
{
"id": "a64cf56c-574c-11f0-9604-020017205654",
"data": {
"iteration": 3
},
"status": "RUNNING",
"message": "Progress update",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:36.767959",
"progress": 60
},
{
"id": "a6e61404-574c-11f0-9604-020017205654",
"data": {
"iteration": 4
},
"status": "RUNNING",
"message": "Progress update",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:37.771507",
"progress": 80
},
{
"id": "a77f3649-574c-11f0-9604-020017205654",
"data": {
"iteration": 5
},
"status": "RUNNING",
"message": "Progress update",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:38.775084",
"progress": 100
},
{
"id": "a815b093-574c-11f0-9604-020017205654",
"data": {
"Task result": "Finished..."
},
"status": "COMPLETED",
"message": "Execution finished.",
"task_id": "a516b352-574c-11f0-9604-020017205654",
"log_time": "2025-07-02 13:58:39.761243",
"progress": 100
}
] |
This example lists all the log entries for the task
associated with the specified application-managed user ID,
task ID stored in the session variable
@task_id
, and created after the
specified date and time.