W. Wesley Groleau asked,
| I have a separate logfile per message, with
|
| LOGFILE = $MAILDIR/Logs/`date '+%y%m%d_%H%M%S'`_$$
|
| at the top of my .procmailrc. It would be just as easy to put
|
| LOGFILE = $MAILDIR/Logs/recipe-name
|
| before each recipe, to have one log file per recipe. Or
|
| LOGFILE = $MAILDIR/Logs/recipe-name.`date '+%y%m%d_%H%M%S'`_$$
|
| to have one logfile per message AND have the filename identify
| which recipe. Or would that result in each non-match recipe also
| producing a log?
Unless (1) verbose logging is on or (2) there is a "?" (exitcode) condition
with a non-zero exitcode, procmail shouldn't log anything for a recipe that
does not pass and whose action line is not run.
However, if your TRAP writes to the logfile, it will write to whatever value
$LOGFILE had last, so that *could* result in writing to the logfile intended
for a recipe that didn't match.
Although it would be a lot of extra code in your rcfile, you could get around
that problem by changing anything of the form [remember, relative paths are
always from $MAILDIR, so you don't have to specify it]:
LOGFILE=Logs/recipe-name.`date '+%y%m%d_%H%M%S'`_$$
:0 flags
* conditions
action
to
:0 condition-related flags
* conditions
{
LOGABSTRACT=on
LOGFILE=Logs/recipe-name.`date '+%y%m%d_%H%M%S'`_$$
:0 action-related flags
action
# in case of `c' flag or fall-through on error
LOGABSTRACT=off
}
or, near the top of your rcfile,
DEFAULTLOG=some_default_place_just_in_case_you_get_unexpected_messages
LOGFILE=$DEFAULTLOG
LOGABSTRACT=on # or "all" if you prefer
and for each special recipe where an item should get its own logfile,
:0 condition-related flags
* conditions
{
LOGFILE=Logs/recipe-name.`date '+%y%m%d_%H%M%S'`_$$
:0 action-related flags
action
# in case of `c' flag or fall-through on error
LOGFILE=$DEFAULTLOG
}
Personally, I'd rather pull the date parameters from the From_ line than
run date(1), but that's a separate matter.