How to log to Sentry from DXP?

Vote:
 

We have been using Sentry as centralised logging platform, which worked fine until we moved to DXP. We did use log4net as framework, which wont work with DXP, we have now switched to EPiServer.Logging but that will not work with Sentry. Sentry supports log4net and Microsoft.Extensions.Logging, but none are working for us. Of course the application specific errors shows up since we have following line in global.asax:

protected void Application_Error()
        {
            var exception = Server.GetLastError();
            // Capture the server errors.
            SentrySdk.CaptureException(exception);
        }

But the appender in episerverlog.config wont work anymore, and that means that everything we log ourselves in the code wont work. 

I can of course write specifically to Sentry everywhere in the code, but it is around 8000 existing places to add and the format differs so it has to be done manually. 

Is there a way I can get the appender to work with Sentry as log4net was working?

#267732
Dec 02, 2021 13:19
Vote:
 

In the DXP all logging that goes through the abstration are set to EPiServer.Logging.TraceLoggerFactory, it's set on the WebApp instances as described here https://world.optimizely.com/documentation/developer-guides/archive/dxp-cloud-services/development-considerations/logging/ 

You could implement additional code to directly log without going through the logging abstraction but first off I'd suggest raising it with Optimizely Support!

#267734
Dec 02, 2021 13:51
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.