I want to extend the default Logger to log errors to Sentry.
How can I extend the Logger implementation? I want to use the base logging functionality with the addition of my custom code.
2 Answer(s)
-
0
You should just need a log4net appender set up.
We use Graylog, so I don't have any experience with Sentry, but a cursory google search found this:
[https://github.com/MCKanpolat/SharpRaven.Log4Net.Core])
-
0
<cite>strix20: </cite> You should just need a log4net appender set up.
We use Graylog, so I don't have any experience with Sentry, but a cursory google search found this:
[https://github.com/MCKanpolat/SharpRaven.Log4Net.Core])
Thanks @strix20 :)
I found a simple solution as well. In my case, I only want real exceptions logged instead of UserFriendlyException. I did some exploration on AspNetBoilerplate docs and found this code to handle all types of exceptions:
public class ExceptionHandler : IEventHandler<AbpHandledExceptionData>, ITransientDependency
Now I can easily filter specific exceptions and log them to Sentry or any other service.