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