Question

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 ?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top