Suppressing internal log4net error messages

I have a console application that should do my best to register with a database in addition to flat files. When there is no network connection (and therefore no connection to the database), log4net prints an error.

log4net:ERROR [AdoNetAppender] Could not open database connection [Data Source=...]
System.Data.SqlClient.SqlException: A network-related or instance-specific 
error occurred while establishing a connection to SQL Server. The server 
was not found or was not accessible. Verify that the instance name is correct 
and that SQL Server is configured to allow remote connections. (provider: 
Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at ...

      

I don't want to see this error in the console. Is there a way to suppress internal log4net error messages? A recompile would be fine, but I would prefer a configuration based setup if possible.

+2


source to share


1 answer


I haven't tested it, but I'm pretty sure the QuietMode property does what you want.



+6


source







All Articles