Is it possible to send messages to a server console or logs via datapack/command blocks

I know that test blocks allow you to do it, but what if I want to send messages to logs/console in older versions? Is it possible? (Apart from advancements)
Continue to help post