Last week, we revamped the way CFEngine formats output. You can continue to use the old output format by specifying the option –legacy-output (-l), but this is considered deprecated and may be removed in a future version.
The key features of the new output format is as follows.
- Consistent look for all messages, as formatting is taken care of by the logger.
- Separate formatting for terminal, syslog, and (eventually) file. Attempts to follow conventions for formatting to separate sinks.
- ISO 8601 timestamps to terminal.
- Every statement is single line.
- No banners and decorations within messages. Conventions for how to write messages.
- Logging levels (e.g. specifying –verbose always implies –inform), aligning with syslog levels.
- Logging system knows about evaluation state and may format messages conditioned on what the CFEngine is currently trying to do.
This is perhaps best illustrated by an example (in this case, written to terminal).
2013-05-13T13:19:34+0200 verbose: Using bundlesequence => {'main'}
2013-05-13T13:19:34+0200 verbose: /main/reports/'hello world': Report: hello world.
2013-05-13T13:19:34+0200 notice: R: hello world
The path in the second statement, /main/reports/‘hello world’, is an example of CFEngine formatting output depending on evaluation state. Here it attempts to evaluate a reports promise in bundle “main”, with the promiser being “Hello world”. Also note how the output of the reports promise is written to terminal in the third line. Because all output is consistently formatted, this results in the terminal output having a timestamp and a log level, rather than the bare “R: hello world” as in the previous version (or with –legacy-output).
We still have a bit to improve in logging. Specifically we want to
- Improve the quality of messages.
- Reduce the number of messages, generally printing only relevant information.
- Use evaluation state in the formatting of more messages, meaning that the context in which the message originated will be more clear.
Please let me know what you think of this change, and how we can improve!
Sigurd Teigen
I’m a programmer working for CFEngine, currently mainly on the community code base. Let me know what new features you would like to see in CFEngine Community. Twitter: @sigurdteigen