Search code examples
session-variableselmah

How to get ELMAH to include session values?


NOTE: I know the various reasons to avoid using the session, but this is a project I've inherited, so please skip that part of any replies :)

Since it's a solved problem, I'm hoping someone can point to an ELMAH patch/branch/fork that includes logging session data rather than reinventing the wheel.

One weird thing is an older post from Atif that says they're already logged:

http://markmail.org/message/ncmdgwm5rmzewbwu

commenter henningst mentioned adding in the session variables here:

http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx

Another approach (I'd rather avoid) is copying the values into cookies

http://www.sharpdeveloper.net/content/archive/2008/11/10/how-to-get-session-or-other-custom-values-into-elmah.aspx

I know one alternative is to switch to something besides ELMAH (like Exceptioneer - see http://exceptioneer.com/Public/ExceptioneerAndELMAH.aspx) but since this is my only problem with ELMAH at the moment, I'd rather just have a patched ELMAH than switch to something else.


Solution

  • Atif replied on twitter to say there's no known patch:

    http://twitter.com/raboof/statuses/7229453423

    So I created a patch that does so:

    http://twitter.com/manningj/statuses/7231616905

    http://blog.sublogic.com/2009/12/patch-to-enable-session-variable-logging-with-elmah/