The best solution I've seen for logging unhandled exceptions in ASP.NET is ELMAH (Error Logging Modules And Handlers).
It is easy to use, the code is clean and well documented.
But that's not all! The author published with Scott Mitchell an article about ELMAH on MSDN. This article is very good and detailed (as usual with Scott). It's also an occasion to see a good way to make use of HTTP Handlers and Modules.
Indispensable to every ASP.NET application!