avoid deadlocks when the LOG_LEVEL is set to DEBUG

`fprintf` and `syslog` are thread-safe but not reentrant.
If a signal happen during those functions and the handler calling them
again, the deadlock is form.  Therefore, we need to block signals until
we leave they realm.