Last post Aug 27, 2018 06:31 PM by DA924
Aug 16, 2018 07:21 PM|javier x brenes|LINK
I have been looking for an answer to this question and I have found nothing.
How can I configure Log4net to use a RollingLogFileAppender when the AdoNetAppender (configure it as the default) can not connect to the database or the connectionString is not the correct one?
In order to clarify this, I have a WebService and I use log4net to save my logs into the database but I had a situation where the connection string had the wrong user and password, that thows an exception and when I tried to save the log of course nothing
was saved because the log4net Ado appender uses the same connection string, If that happens, I would like to save the logs using another append.
It could be using RollingLogFileAppender to get a log File.
how can I accomplish this ?
Aug 17, 2018 07:04 AM|WatcherR|LINK
Aug 27, 2018 05:22 PM|javier x brenes|LINK
hi WatcherR, I done that already, my questions is more like if It's possible to use an extra way to logging (like write in a file) when I do not have access to the database.
Imagine a desktop app and there is not network connection, so I can't save my logs on the database, Is there a way using log4net where I can say "ok if you cannot save the log on the database, well use this another appender"?
does it make sense ?
Aug 27, 2018 06:31 PM|DA924|LINK
There is no solution for this, other than, you doing some kind of test check for the connectivity to the database and terminate the program if the connectivity check fails.