[PATCH] Re: Limit msg body length in debug output

Sebastian Spaeth Sebastian at SSpaeth.de
Thu May 5 22:56:28 BST 2011


On Thu, 5 May 2011 20:18:24 +0200, Nicolas Sebrecht <nicolas.s-dev at laposte.net> wrote:
> > Only output the first and last 100 bytes of each message body to the
> > debug log (we still get the full body from imaplib2 logging). This
> > limits privacy issues when handing the log to someone else, but usually
> > still contains all the interesting bits that we want to see in a log.
> 
> I don't think it's a good strategy. We may have errors due to unexpected
> headers or so. I would rather keep the whole headers (maybe trimed from the
> "Received:" content, though).

I agree that it would be nicer.
But that would entail some content analysis of each and every email
that we handle. I don't want to think about the performance impact of
that. Just outputting the first 100 and last 100 bytes was a nice
tradeoff that doesn't cost perf and let's us identify which mail is
being transferred.

We currently still get the full body in the imaplib2 debug log, so that
each message is now (fully) twice in our debug logs. I am not sure what
the correct solution would be. Perhaps do the mail content analysis only
in debug mode and output only the headers then...? Still, this patch
would be an improvement until then. But it's your call, I won't be sad
if this is not applied. :)

> Why should we care of the last byte of the message?

To see if a message was fully transmitted or cut off somewhere. Perhaps
first 200bytes + last 5 bytes will most of the time include all headers?
Not sure.

Seb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110505/47339683/attachment-0001.sig>


More information about the OfflineIMAP-project mailing list