Pergunta

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 ?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top