Engaging with E-mails
The output of the script discussed will be similar to the following:
$ python3 logger_mail_send.py
2014-10-25 13:15:07,124 INFO First line of log
2014-10-25 13:15:07,127 INFO Second line of log
2014-10-25 13:15:07,127 INFO Third line of log
2014-10-25 13:15:07,129 INFO Fourth line of log
Now, when you check the e-mail message with the e-mail command (native to
Linux/UNIX machines), you can expect that the e-mail would have been received
by the local user, as shown in the following:
Mail version 8.1.2 01/15/2001. Type? for help.
"/var/mail/faruq": 1 message 1 new
N 1 you@yourdomain Sat Oct 25 13:15 20/786 Test Logging
email from Python logging module (buffering)
You can view the content of the message by typing the message ID on the command
prompt with &, as shown in the following output:
& 1
Message 1:
From you@yourdomain Sat Oct 25 13:15:08 2014
Envelope-to: faruq@localhost
Delivery-date: Sat, 25 Oct 2014 13:15:08 +0100
Date: Sat, 25 Oct 2014 13:15:07 +0100
From: you@yourdomain
To: faruq@localhost
Subject: Test Logging email from Python logging module (buffering)
2014-10-25 13:15:07,124 INFO First line of log
2014-10-25 13:15:07,127 INFO Second line of log
2014-10-25 13:15:07,127 INFO Third line of log
2014-10-25 13:15:07,129 INFO Fourth line of log