[Buildbot-devel] messageFormatter which includes last 50 lines from log file is including < 50 lines when the log file is 77 lines

William Deegan bill at baddogconsulting.com
Thu Mar 31 21:23:03 UTC 2011


Greetings,

We have a messageFormatter specified to our MailNotifier. 
It's more or less a copy of the example in the user manual.
http://buildbot.net/buildbot/docs/current/MailNotifier.html#MailNotifier

the relevant portion is :
        logs = build.getLogs()
        # logs within a step are in reverse order. Search back until we find last failing step's stdio
        # TODO: combine all failing step's stdio
        failed_stdios = []
        for log in reversed(logs):
            status, dummy = log.getStep().getResults()
            if status == FAILURE and log.getName() == 'stdio':
                failed_stdios.append(log)

        for log in failed_stdios:
            name = "%s.%s" % (log.getStep().getName(), log.getName())
            content = log.getText().splitlines() # Note: can be VERY LARGE
            url = u'%s/steps/%s/logs/%s' % (master_status.getURLForThing(build),
                                           log.getStep().getName(),
                                           log.getName())
 
            text.append(u'<i>Detailed log of failing build step:</i> <a href="%s">%s</a>'
                        % (url, url))
            text.append(u'<br>')
            text.append(u'<h4>Last %d lines of "%s"</h4>' % (limit_lines, name))
            unilist = list()
            for line in content[len(content)-limit_lines:]:
                unilist.append(cgi.escape(unicode(line,'utf-8')))
            text.append(u'<pre>')
            for uniline in unilist:
                text.append(uniline)
            text.append(u'</pre>')
            text.append(u'<br>')


The log file in question:
$ bzcat 1156-log-diff_warnings-stdio.bz2 | wc
     77     295    5001


Any idea what's going wrong here?

Thanks,
Bill

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20110331/6772a801/attachment.html>


More information about the devel mailing list