Episerver uses Log4Net as its default error handler.  The benefit of Log4Net for a developer is that you can also use it with very minimal configuration.  Log4Net is a really simple and flexible error handling system that are far better to use instead of having to come up with a custom solution yourself, or, importing additional bloat from Nuge.

All you have to do is enable it in the config, send your exception to Log4Net in your code and everything else is done for you. To get start using Log4Net on your site First, in your webroot, you will need to make a few tweaks to a file called 'EPiServerLog.config'.  This is where all the logging configuration lives.  At the end of that file, you should see a section that looks similar to the below snippet. All you need to do to enable Log4Net on your site is to enable the appender ref so your config should look like this :

Boom! That's all there is to it, Log4Net is now configured for your site.. simple hey? The next step is sending your exceptions to Log4Net to the handler. First, you need to add a reference to the assembly in your class:

Your next step is to declare the logger as an instance variable in your class :

What we're doing here is using reflection to tell Log4Net the class name to log (if you rename it you don't have to remember to update your logging reference). I normally add this into a base class so I only define it once but it's up to you. Next, send any exceptions you may trap to Log4Net.

The code snippets pretty simple, you just call Log4Net rather than throwing the exception. I also find the Logger.Info method pretty useful at times and it's worth doing some research on. Now you have your system up and running how do you read these exceptions ?

WIthin your webroot you should now have a file called 'EPiServerErrorLog.txt' everything is sent to there. In Epi the default is to log all warnings (set in the EPiServerLog.config file). I normally only set my logger to log a fatal issue as the warning level is too verbose. For reference you can use FATAL, ERROR, WARN, INFO, DEBUG. That's all there is to it. Enjoy :)