Callback Running User and Debug Logs
You can explicitly set the OwnerId to another value. For example, to assign a task to a specific user, set the task OwnerId to that user’s ID.
To collect debug logs for the callback’s execution, add a trace flag for Automated Process. For more information, see Add a Trace Flag Entry for the Default Automated Process User in the Platform Events Developer Guide.
When the callback is invoked, it’s logged in the debug log. Logging for the callback requires the System debug log level to be set to at least Info. For more information, see Set Up Debug Logging. For example, when the callback is invoked, the debug log line looks as follows.
CODE_UNIT_STARTED [EXTERNAL]|platform.event.publish.callbacks.tasks.apex.ApexCallbackMethodInvoker