Ensure logger flushing before exit, escape format string characters in classloader warnings.

Signed-off-by: Ross Allan <rallanpcl@gmail.com>