No, it won't work.
"sieve_after" require user script to explicitly "keep" the message. If the script fails, the default action stores the message into INBOX, thus finishing executions of sieve scripts. So, in most wanted case the "sieve_after" which suppose to notify user about problems with his script will not be called. These logs contain messages about syntax errors which depend on the exact environment (say, the list of enabled Sieve extensions). Also they have reports about runtime problems like absent folder referenced in the script. It is a bad situation if user can not read these logs.
I see a couple workarounds.
First: a separate FilterSet which user can activate to get .dovecot.sieve.log when he wants. It can be something like
===
$ cat /srv/dovecot/seriv/.dovecot.sieve
require ["vnd.dovecot.execute"];
# rule:[dovecot.sieve.log]
if header :contains "subject" "dovecot.sieve.log"
{
execute "log_content.sh";
}
===
with
===
$ cat /usr/lib64/dovecot/sieve-extprograms/log_content.sh
#!/bin/bash
if test -s $HOME/.dovecot.sieve.log; then
/usr/bin/mailx -s "sieve.log" $recipient < $HOME/.dovecot.sieve.log
/usr/bin/echo -n '' > $HOME/.dovecot.sieve.log
fi
====
" on my IMAP server. When user sends to this address a request, it replies with content of users .dovecot.sieve.log emptying it afterwards. It should have access to the "SENDER" external variable. If needed there should be 2 step authentication against forged "SENDER", sending cryptographically strong token and asking user to reply with the same token to authorize request and emptying log. But isn't it too much complexity for such thing as looking at the log?