[SERVER-18572] resmoke.py should prefix test log output with a timestamp Created: 19/May/15  Updated: 05/Feb/16  Resolved: 23/Jun/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.1.5

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Max Hirschhorn
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Quint Iteration 5
Participants:

 Description   

Should format the timestamps according to ISO 8601 to match the server's output, e.g. 2015-05-19T16:36:57.130-0400. This would make it possible to then download the raw logs from logkeeper and sort them to get a timestamp ordering.



 Comments   
Comment by Githook User [ 23/Jun/15 ]

Author:

{u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}

Message: SERVER-18572 Use the same timestamp format as MongoDB log messages.
Branch: master
https://github.com/mongodb/mongo/commit/528d028b50c3f632591b84511a873302ea27c14d

Comment by Max Hirschhorn [ 29/May/15 ]

The logging.Formatter class takes a datefmt keyword argument, but time.strftime() does not expose a way to get the number of milliseconds (only microseconds). resmoke.py should define its own formatter that overrides the formatTime method to do what we want.

For reference, the Python 2.6 implementation:

def formatTime(self, record, datefmt=None):
    # ... docstring omitted ...
    ct = self.converter(record.created)
    if datefmt:
        s = time.strftime(datefmt, ct)
    else:
        t = time.strftime("%Y-%m-%d %H:%M:%S", ct)
        s = "%s,%03d" % (t, record.msecs)
    return s

Generated at Thu Feb 08 03:48:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.