Posts

Showing posts from May, 2012

Job Logging in Upstart

Job Logging in Upstart The big Upstart feature in Ubuntu Precise is "job logging" (in fact, it turned out to be a significantly bigger feature than we'd originally envisaged :-). This had been a wishlist item for some time and a lot of folk were very keen to see this implemented. All system jobs now have their stdout and stderr logged automatically  by default to a text file in directory  /var/log/upstart/ . Why did we make this the default? Surely daemons and services don't generally write any output? True, but when they do produce output, it is worth capturing since it has a very high chance of being an error message. And errors should not be ignored. For jobs that do not produce any output, there is minimal overhead and of course no log is written. The logger actually uses pseudo-ptys just like  script(1) , xterm(1) , expect(1) ,  screen(1)  et al . This is advantageous for a number of reasons, but from the logging perspective the biggie is &quo

A quick libnih tutorial

Introduction The NIH Utility Library ( libnih ) is a small, efficient and most importantly safe library of general purpose routines. It was written by Keybuk so you can be assured that it is extremely elegant, well-designed, well-tested (includes 2863 tests currently!) and well-written. NIH is used by Upstart, the event-based init daemon which is used by: Ubuntu Desktop Ubuntu Server Ubuntu Cloud RedHats RHEL 6 Chromium OS  (and Chrome OS) That's a lot of deployments of Upstart and NIH around the world!! (And we're not even including mobile device operating systems in that list). But why not just use glib I hear you ask? Well, glib is a very large library whereas NIH is small and designed for low-level daemons and systems which may be resource-constrained. Also, lets not forget that NIH, like Upstart , comes with a very comprehensive test suite so bugs are rare. Other reasons to use NIH: It handles garbage collection for you That's rig