* Ruud H.G. van Tol <rvtol(_at_)isolution(_dot_)nl> [2005-01-08 12:30]:
I assume that you checked the log as to what gets into those
variables but I would always put quotes around:
BEENTHERE_PREFIX_ML = '(\
dia-list\
|gnupg-[a-z0-9]+\
|procmail)'
(because embedded space would do things without them).
That's a good idea.. I think I recall trailing whitespace causing me
trouble before. I'm going to use single quotes for these cases now,
and double quotes when a variable is nested.
The logs are impossible to follow because the output is all out of
sequence.
I often do things like:
LOG = "$$${TAB}BT_P_ML(${BEENTHERE_PREFIX_ML})${NL}"
where $$ is the current PID (each fork has its own).
That was quite helpful. I've decided to make use of the $$ variable,
but I've decided to use it to name the log file itself. The beginning
of my main script now begins with the following (abridged) code:
PROCESSED_YEAR = `date +"%Y"` #year
PROCESSED_WOY = `date +"%V"` #week of year
LOGDIR = $HOME/logs/procmail_${PROCESSED_YEAR}-$PROCESSED_WOY/
# Ensure the existance of LOGDIR
:0 c
*$ ! ? test -d $LOGDIR
| mkdir $LOGDIR
LOGFILE = $LOGDIR/$$.log
I was initially afraid to clutter up my logs, but I'm glad I did it
this way. This is proving to be great for continuity of sanity, and I
wish I'd done it earlier.
With this type of organization, tracking down a piece of log based on
an email is just a matter of going to $LOGDIR, and doing a
grep -i 'folder: ' *
I'm thinking of taking this a step further, and adding an
X-Procmail-Log header to every email, which would point back to the
matching log file.
But then if I decide to get that anal, I might as well name the
logfile after the Messege-Id header instead of the pid. Does anyone
do this? I guess filenames would get quite ugly; so I figure the way
to go is name the log file after an MD5 hash of the Message-Id.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail