Fix syslog progname

Fix syslog progname

Despite the name ‘MailReceiverBase’, this class is also used
for fast-smtp-rejection, so tagging all its log messages as coming
from ‘receive-mail’ is terribly confusing.

From 06ffa58d93367b4fe648d2e9b2a5a87c0847633e Mon Sep 17 00:00:00 2001
From: Matt Palmer <mpalmer@hezmatt.org>
Date: Tue, 9 Oct 2018 12:34:06 +1100
Subject: [PATCH] Fix syslog progname

Despite the name 'MailReceiverBase', this class is also used
for fast-smtp-rejection, so tagging all its log messages as coming
from 'receive-mail' is terribly confusing.

diff --git a/lib/mail_receiver/mail_receiver_base.rb b/lib/mail_receiver/mail_receiver_base.rb
index 35fe24a..e331c98 100644
--- a/lib/mail_receiver/mail_receiver_base.rb
+++ b/lib/mail_receiver/mail_receiver_base.rb
@@ -20,7 +20,7 @@ class MailReceiverBase
 	end
 
 	def self.logger
-		@logger ||= Syslog.open("receive-mail", Syslog::LOG_PID, Syslog::LOG_MAIL)
+		@logger ||= Syslog.open(File.basename($0), Syslog::LOG_PID, Syslog::LOG_MAIL)
 	end
 
 	def logger

GitHub

1 Like