user5412: I'm wondering how to log/print/trace any message during the execution of a contract when submitted to the blockchain via cardano-cli.
So basically I hoped this very simple test script would show me something:
mkValidator :: ContractInfo -> () -> () -> ScriptContext -> Bool
mkValidator _ _ _ _ = (traceIfFalse "Test" False) || True

However, when submitting a transaction with this script to cardano-cli, it gets executed without printing anything.

user2248: Your validator is basically False || True, which will always return True. The value from traceIfFalse is only passed to the user if the final result of the validator is False.
So if you are using the most recent version of cardano-cli the error should appear once you try to build a transaction removing the || True part. If you want, however, to log an error even when the validation succeeds, this is impossible with Plutus, at least on-chain.

5412: <p>I'm wondering how to log/print/trace any message during the execution of a contract when submitted to the blockchain via <code>cardano-cli</code>.
So basically I hoped this very simple test script would show me something:</p>
<pre><code>mkValidator :: ContractInfo -&gt; () -&gt; () -&gt; ScriptContext -&gt; Bool
mkValidator _ _ _ _ = (traceIfFalse &quot;Test&quot; False) || True
</code></pre>
<p>However, when submitting a transaction with this script to <code>cardano-cli</code>, it gets executed without printing anything.</p>
 2248: <p>Your validator is basically <code>False || True</code>, which will always return <code>True</code>. The value from <code>traceIfFalse</code> is only passed to the user if the final result of the validator is False.</p>
<p>So if you are using the most recent version of cardano-cli the error should appear once you try to build a transaction removing the <code>|| True</code> part. If you want, however, to log an error even when the validation succeeds, this is impossible with Plutus, at least on-chain.</p>
