logging output format is less awesome that it used to be

Ian Booth ian.booth at canonical.com
Tue Mar 19 06:32:08 UTC 2013



On 19/03/13 14:11, David Cheney wrote:
> Just to kick over a recently settled hornets nest, the logging output is less
> awesome than it used to be
>

Was it ever really awesome? I don't think it could be called awesome :-)

> ^ why is the date string in the middle of the line? why does every line start
> JUJU rather than INFO/WARN/ERROR/etc ?
>

The previous logging incarnation did not prepend all lines with INFO/WARNING etc
either - it was done adhoc and most times not at all. Also, lines were output
like so:

Target.Output(2, "JUJU "+fmt.Sprintf(format, v...))

hence they all started with JUJU just like the current version. So there's no
real difference there AFAICT.

The Go log Prefix attribute has been set to "JUJU:<cmd name>", where <cmd name>
evaluates to "<super command>:<sub command>" eg "juju:bootstrap"

The Go logger puts the log prefix as the first thing on the line, before the
formatted header containing the datetime. Go's logger appears very primitive and
it's not possible AFAIK to log using a format template where such things can be
controlled properly :-(

The current logging offers a consistently formatted message:

JUJU:<cmd name>:<datetime> <severity> <message>

> Is this going to be fixed by a followup branch ?
> 
> Should I log a bug about this ?
> 

It would have been nice to done more with this but time moves on and my main
focus was to ensure consistent output containing the key pieces of information
to help facilitate supportability. I guess it depends what fixed means. We are
limited by what Go std lib offers here, unless we want to do a bit of bespoke
work, in which case we'd have our own logger implementation. Maybe if we want to
identify what key issue(s) in particular are irksome, they can be quickly fixed.






More information about the Juju-dev mailing list