سؤال

I am using ServiceStack logger and need to know if my logger is properly initialized or not. When I call LogManager.GetLogger(...) there is no way to know if the call was successful or not. If app.config contains error logger will not be initialized and my code will not have any idea about it. Is there any way to check whether logger is properly initialized or not ?

هل كانت مفيدة؟

المحلول

You can see if there are any appender initialized:

  LogManager.GetRepository().GetAppenders().Count();

The Log4net logging itself (i.e. the logging methods) are by designed to fail silently. They should not interact with your program.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top