Error Signal . From Currentcontext .raise
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Programmatically Logging Errors With Elmah : Logging specific information up vote 17 down vote favorite 1 I am logging error with Elmah inside a try-catch block. here is the code; try { DateTime.Parse("poo"); } catch (Exception err) { Elmah.ErrorSignal.FromCurrentContext().Raise(err); } I would like to log some specific info like some information which can be retrieved from previous methods or properties on the same context but the Exception properties are readonly. what is the best way to do that? My main goal is to be able to do something like below; } catch (Exception err) { err.Message += "poo"; Elmah.ErrorSignal.FromCurrentContext().Raise(err); } .net asp.net exception exception-handling elmah share|improve this question edited Jul 2 '11 at 11:29 asked Jul 2 '11 at 11:18 tugberk 29k31173264 add a comment| 1 Answer 1 active oldest votes up vote 26 down vote accepted You could create your own exception object and pass that to Elmah. Setup a static helper method and do something like public static void HandleError(Exception ex, String customMsg) { Exception newEx = new Exception(customMsg, ex); Elmah.ErrorSignal.FromCurrentContext().Raise(newEx); } share|improve this answer answered Jul 3 '11 at 1:51 Geo 28632 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged .net asp.net exception exception-handling elmah or ask your own question. asked 5 years ago viewed 5140 times active 5 y
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just http://stackoverflow.com/questions/6556684/programmatically-logging-errors-with-elmah-logging-specific-information like you, helping each other. Join them; it only takes a minute: Sign up ELMAH - ErrorSignal.Raise no stack info up vote 2 down vote favorite 3 I am catching an exception and logging it with ELMAH. If I do not catch the exception and let the app YSOD, ELMAH logs the full stack trace. However when http://stackoverflow.com/questions/5549934/elmah-errorsignal-raise-no-stack-info I catch and use ErrorSignal.Raise(ex), I do not get the stack trace. I also tried to no avail: ErrorSignal.FromCurrentContext().Raise(new System.ApplicationException(exception.ToString(), exception)); Whassup? elmah share|improve this question asked Apr 5 '11 at 9:40 jenson-button-event 8,30633687 add a comment| 2 Answers 2 active oldest votes up vote 9 down vote You're using ErrorSignal.Raise with an unthrown exception that you've just new'd up. The stack trace gets populated when you throw the exception, so your unthrown exception won't have a stack trace. ELMAH, on the other hand, will catch the exception instance you're wrapping here -- which, if you look at it in the debugger, will in fact contain the stack trace, unlike the wrapping exception. Instead of wrapping in a System.ApplicationException (which, by the way you should originally have inherited from and nowadays is considered obsolete by the framework designers), you should just raise the original exception you have caught. As an interesting side note: Since the stack trace is populated when you throw an exception, this: catch (
the Goodie Bag Deployment Tracking Improved Message Grouping Decorating errors with version number using Azure Websites Restructuring Plans and Pricing Writing custom error loggers for ELMAH New Features for App Store Developers 2016 August Usage Monitoring http://blog.elmah.io/how-to-log-errors-to-elmah-programmatically/ Support for Logary Permanent link to search results ELMAH security and allowRemoteAccess explained Bulk managing users in an organisation Filtering Errors by IP Addresses ASP.NET Core Status Infinite Scroll (Well Almost) 2016 July Support for .NET and ASP.NET Core Organization Support 2016 June .NET Logging Tools and Libraries Installation Help Directly Inside elmah.io 2016 May Ignore Errors Generated by Bots 2016 April Redesigned Dashboard with Drag and Drop 2016 March Adding Version Information error signal to your Log ELMAH Configuration Validator The ELMAH Schema 10 Improvements in 10 Days Roundup ELMAH Security Validator MyGet Discount Available in the Goodie Bag An Even Better Toolbar User Agent View 2016 February Nicely Formatted Dates Status Code with a Vengeance Compact Toolbar Two new and fun products in the Goodie bag Increased session timeout HTTP method on URLs 10 Improvements in 10 Days 2016 January The elmah.io AppStore 2015 December Discounts error signal . on popular .NET tools with the elmah.io Goodie Bag elmah.io Technology Stack Yearly Subscriptions ASP.NET Error Logging Best Practices 2015 September Danish service provides maximum scaling and secures data on Azure elmah.io documentation Building a salable architecture to handle millions of errors 2015 August Sending transactional emails using Mandrill and .NET Logging to elmah.io from NLog Umbraco and elmah.io are new best friends 2015 July Receive an email when a new error is logged It’s official – elmah.io integrates with Zapier 2015 June New mail template Integrate elmah.io with Slack Integrate elmah.io with HipChat How to use Extended User Details even though you don’t use email as user ID 2015 May Get better insights with the error occurence graph Removing sensitive form data before logging to ELMAH 2015 April Logging to multiple ELMAH logs Daily Digest Email Invoicing API v2 Released 2015 March Extended User Details 2015 February Logging custom data to elmah.io 2015 January Trial accounts introduced 2014 December API v2 Beta Released 2014 November ELMAH Code Snippets for Visual Studio elmah.io have been accepted onto Microsoft BizSpark 2014 October How to log errors to ELMAH programmatically 2014 September ELMAH vs log4net Logging to elmah.io through a HTTP proxy 2014 August Logging to elmah.io from JavaScript using JSNLog Great new features for our paying customers 2014