Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 79709 - improved emerge.log timestamp format
Summary: improved emerge.log timestamp format
Status: RESOLVED WORKSFORME
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-27 05:56 UTC by Ralph Jones
Modified: 2005-02-28 08:24 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Jones 2005-01-27 05:56:19 UTC
emerge.log currently prints the timestamp on each line as the number of seconds since the "epoch".  This is not very human readable.

This is because the python function time.time() is used to print the time here.   The following one line change outputs the timestamp in the format "YYY-MM-DD HH:MM:SS":

diff /usr/bin/emerge /usr/bin/emerge.new
411c411
<               mylogfile.write(str(time.time())[:10]+": "+mystr+"\n")
---
>               mylogfile.write(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())+" : "+mystr+"\n")

(If you want to log the UTC timestamp, use the gmtime() function instead of localtime()).

Please include this fix as soon as possible as it really makes it a lot easier to read the emerge log.

See this link for the relevant forum discussion.
http://forums.gentoo.org/viewtopic.php?t=238052

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Marius Mauch (RETIRED) gentoo-dev 2005-01-27 23:43:59 UTC
Hmm, this would break several popular tools.
Comment 2 Brian Harring (RETIRED) gentoo-dev 2005-02-01 23:48:45 UTC
-mylogfile.write(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())+" : "+mystr+"\n")
+mylogfile.write("%s :%s\n" % (time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()), mystr))

Slightly cleaner imo. :)
Comment 3 Brian Harring (RETIRED) gentoo-dev 2005-02-01 23:51:07 UTC
Marius, specific tools?  Strikes me as cleaner to have it human readable, rather then epoch.
If it's massive horkage, could make it an option/deploy it in a major release, although I'm inclined to think detection and handling of the two formats shouldn't be all that hard.
Comment 4 Marius Mauch (RETIRED) gentoo-dev 2005-02-03 15:32:10 UTC
genlop, splat, probably also basc
generally everything that analyzes build time
Comment 5 Nicholas Jones (RETIRED) gentoo-dev 2005-02-06 03:56:21 UTC
Portage prints the start time at the begining each instance in local format.

If you want it prettier, I'd suggest using a tool to convert it from
easily machine readable to easily human readable.

Epochs are a lot easier to difference without thinking too much.
Comment 6 Nicholas Jones (RETIRED) gentoo-dev 2005-02-28 08:24:21 UTC
>>> time.ctime(1109600265)
'Mon Feb 28 09:17:45 2005'

As mentioned.