Shipping Sitecore Errors to

Shipping Sitecore Errors to

Best practice for Sitecore ALM is to know when your app is erroring, and if a new deployment is causing the issues. This may not be readily apparent with simple up/down monitors or other online tracking, if the issue is sporadic. So shipping out error logs and getting alerted to them is very important for a reliable application.

That's where and other tracking services come in. It can gather up error messages, tell you where they are happening, when, and on which browsers. You can track user behavior with breadcrumbs, and log additional information for the development team to help identify the issue in production. And ain't it fun to debug in production!

The code is super simple and you can add onto it, to include any additional info about your browser or environment.

First add the proper NuGet packages to your project.

Then you just need one class, the CustomAppender class.

Then a Sitecore config, to tie it all together. What this does is create a new Appended for log4net. Then using the <filter> attribute, only Errors are allowed to be logged. The filter ONLY is for our new appender. The normal Sitecore logger is still going to catch the level of events you have set. The <root> delete and patch will add our second appender to the main Sitecore logger.

Ta da! Error logs that are not on the server!!!!

Special thanks to JammyKam for helping me figure this out.