[systemd-devel] [PATCH] journalctl: add --utc option

Lennart Poettering lennart at poettering.net
Mon Oct 6 04:10:27 PDT 2014


On Thu, 02.10.14 12:51, Josh Triplett (josh at joshtriplett.org) wrote:

> On Thu, Oct 02, 2014 at 09:11:39PM +0200, Lennart Poettering wrote:
> > On Thu, 02.10.14 11:56, Josh Triplett (josh at joshtriplett.org) wrote:
> > 
> > > On Thu, Oct 02, 2014 at 09:36:46AM +0200, Jan Synacek wrote:
> > > > Introduce option to display time in UTC.
> > > 
> > > Does "TZ=UTC journalctl" not do the right thing?  A quick test here
> > > suggests that it does.  That seems preferable to teaching individual
> > > tools to special-case UTC.
> > 
> > Not sure i agree. --utc really should only have an effect on our own
> > output, and that's a good thing. If you set $TZ you end up changing
> > much much more, for example the logic of glibc's own syslog() and what
> > it passes on, and we shouldn't influence that.
> 
> True, but in the case of journalctl, which just queries and outputs
> journal data, what would TZ=UTC affect that you *wouldn't* want?
> journalctl shouldn't be calling syslog().

Well, who knows what is ultimately called. I mean, we fork off a
$PAGER, which can be almost anything. We call into libraries and
whatnot. All I am saying is that I think there's great value to
keeping this as local as possible, and have this only effect the log
display we do and nothing else.

And beyond that: an environment variable is in many ways awful API,
and non-discoverable. A command line switch is a lot more
discoverable, as everybody knows to look for them in --help and in man
pages.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list