diff options
Diffstat (limited to 'scripts/post')
| -rwxr-xr-x | scripts/post | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/post b/scripts/post index 1142f3abf..0f5b268ec 100755 --- a/scripts/post +++ b/scripts/post @@ -24,19 +24,26 @@ through the mail wrapper. E.g. for list `test@yourdomain.com', the `test' alias would deliver to this script. Stdin is the mail message, and argv[1] is the name of the target mailing list. + +Errors are redirected to logs/error. """ import sys +import logging import paths from Mailman import Utils from Mailman import mm_cfg +from Mailman import loginit from Mailman.Queue.sbcache import get_switchboard from Mailman.i18n import _ def main(): + # Setup logging to stderr stream and error log. + loginit.initialize(propagate=True) + log = logging.getLogger('mailman.error') # XXX If you've configured your list or aliases so poorly as to get either # of these first two errors, there's little that can be done to save your # messages. They will be lost. Minimal testing of new lists should avoid @@ -44,11 +51,11 @@ def main(): try: listname = sys.argv[1] except IndexError: - print >> sys.stderr, _('post script got no listname.') + log.error(_('post script got no listname.')) sys.exit(1) # Make sure the list exists if not Utils.list_exists(listname): - print >> sys.stderr, _('post script, list not found: %(listname)s') + log.error(_('post script, list not found: %(listname)s')) sys.exit(1) # Immediately queue the message for the incoming qrunner to process. The # advantage to this approach is that messages should never get lost -- |
