Messaging: Do not write to logfile if it is not open.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>