When to log exception?
- by Rune
try
{
// Code
}
catch (Exception ex)
{
Logger.Log("Message", ex);
throw;
}
In the case of a library, should I even log the exception? Should I just throw it and allow the application to log it? My concern is that if I log the exception in the library, there will be many duplicates (because the library layer will log it, the application layer will log it, and anything in between), but if I don't log it in the library, it'll be hard to track down bugs. Is there a best practices for this?