I have a wcf service which calls a stored procedure in sql database. I use log4net for logging purpose.
If any sql exception is thrown from the database, I can get the sql exception properties like procedure name, error line, severity etc., from the exception object in the service.
But is there a way to directly log those properties in a file using log4net?.
Follow these steps:
Add the following code to global declaring
Add this code to your constructor
Copy the following to your config file under configuration tag
in the try...catch(Exception ex) add the following line