Re: Basic question: How to debug sieve scripts (e.g. via log file)?

Ken Murchison <[email protected]>
Newsgroups gmane.mail.imap.cyrus
Message-ID <[email protected]>
With Cyrus 3.2+, we added a 'log' Sieve action, which allows the script 
to write messages to syslog().  This could be used to debug your script 
by logging each if/elsif/else, etc.  In order to use this action to need to:

require "vnd.cyrus.log";

log "start of script";

...


On 12/7/23 6:06 PM, Binarus wrote:
> Dear all,
> 
> I am a long time user of Cyrus imapd, but from time to time, there are
> new questions. The following might be embarrassing for me, but here we
> go:
> 
> During the last days, I have put some time into trying to find out how
> to debug sieve scripts as they are executed. One of my scripts doesn't
> behave as expected; it would help if I could see in the log files what
> the problem is.
> 
> However, I didn't find out how to make Cyrus imapd output something
> sieve-related into the log files at all. I also didn't find a
> standalone test program for sieve scripts in the Cyrus packages.
> 
> Starting cyrmaster in debug mode (-D) or activating the debug mode in
> cyrus.conf didn't help either; no sieve-related messages were in the
> terminal or in the log files.
> 
> In this case, I am on Debian bullseye with the stock Cyrus imapd 3.2.6.
> 
> I have realized that Debian bullseye offers a package called
> "dovecot-sieve" which contains a program called "sieve-test". However,
> I believe that the dovecot sieve utilities cannot be used to process
> or test sieve scripts for Cyrus imapd; please correct me if I am wrong.
> 
> Could anybody please shortly explain how I could make Cyrus imapd put
> sieve-related messages into the log files, or how I could debug sieve
> scripts in general?
> 
> Thank you very much in advance, and best regards,
> 
> Binarus
> 
> P.S. I am aware that Cyrus' sieveshell throws errors if a script
> contains syntax errors. But that's not what I am after. I'd like to
> gain a little insight into how the scripts behave at runtime, or at
> least see errors that occur as they are executed.
> 
> P.P.S. I know that my version is old. If somebody proposes an upgrade,
> it would be very nice to know whether debugging sieve scripts is
> possible with the proposed version. The reason is that upgrading to a
> new version in Debian generally means compiling that version. For
> various reasons, that is often a real hassle; I'd only like to do it
> if I knew that the situation regarding sieve debugging has changed.

-- 
Kenneth Murchison
Senior Software Developer
Fastmail US LLC


------------------------------------------
Cyrus: Info
Permalink: https://cyrus.topicbox.com/groups/info/T9b1dfc1611f58964-M4517d59126887b04030fca09
Delivery options: https://cyrus.topicbox.com/groups/info/subscription
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.