messages: split logger initialization in two phases
To initialize logging, we typically need configuration and command line
parameters. And using modules would also be nice. But we also want to
emit log messages while initializing the configuration and the modules
bank. This is a catch-22.
To work around the problem, we store the early log messages in a
temporary list, and drain the list later once logging is configured.
(Also fix a minor integer overflow involving atoi().)