although we've followed the instructions to the letter and we get into this piece of code in the RaygunLoggerProvider:
public ILogger CreateLogger(string categoryName)
{
return _loggers.GetOrAdd(categoryName, x => new RaygunLogger(categoryName, _config));
}
but we never actually hit our logger...
has anyone else done something like this, i.e. added their own implementation for the ILogger interface, added it to the logger collection and hit their code?!
as ever, any suggestions would be really appreciated!
How to add a custom RayGun ILogger implementation to a v9 site to log handled exceptions
hey out there,
we're trying to add a RayGun logger to a v9 site to catch handled exceptions, e.g. where we've something like the following:
back in v8 days, we followed these instructions:
Full C# control over Serilog configuration
however there isn't an equivalent in v9 in the docos. we're guessing this is due to v9 now using the
Microsoft.Extensions.Logging.ILogger
interface.we've been experimenting and the closest we can find to what we're trying to achieve is this blog post:
https://www.iambacon.co.uk/blog/logging-exceptions-to-raygun-from-your-blazor-server-app
although we've followed the instructions to the letter and we get into this piece of code in the
RaygunLoggerProvider
:but we never actually hit our logger...
has anyone else done something like this, i.e. added their own implementation for the
ILogger
interface, added it to the logger collection and hit their code?!as ever, any suggestions would be really appreciated!
after some more hunting, we finally found the solution!
no code changes required, the trick is to add the following package:
Mindscape.Raygun4Net.AspNetCore
and then add the following to your
appsettings.json
:just replace
YourRaygunApiKey
and you're in business ;)is working on a reply...