Solution 1:

By using the /gamerulecommand.


The command:

/gamerule sendCommandFeedback false

will affect "whether the feedback from commands executed by a player should show up in chat."