- work around segfault at exit caused by libxml2. - fix foreground logging (also fixes shutdown needing extra signal bug).