There is to my knowledge no way to run these commands in the console, because a dimension is required but I do not know how to provide it.
This is the result when trying to run the command:
tellme locate block to-console simple all-loaded-chunks minecraft:oak_log
[19:32:47] [Server thread/INFO] [minecraft/DedicatedServer]: This command must either be executed by an entity, or the dimension must be specified
I should clarify that I'm using Forge 1.18