Fix a logging bug for dynamic lib loading exception

The ::dlerror() will return NULL in the logging macro, so that the exception won't be logged correctly.