NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
862 stars 170 forks source link

Ability to log request body on newer occurances of same error when selected so from error details view so that it helps quick/easy debugging of error #60

Closed ismusidhu closed 8 years ago

ismusidhu commented 9 years ago

As a developer-user of Exceptional, when I select an option to log request body from error details screen, I would like it to also log request body on newer occurrences of that error so that I can debug/reproduce/fix those errors quickly

NickCraver commented 9 years ago

You have two already-existing options here. Option 1 would to not roll up specific errors based on the hash (which happens by default over an interval of 10 minutes). You can do this per-error by clearing the hash before it's logged if you wish. Here's how you'd do it:

ErrorStore.OnBeforeLog += (sender, args) => 
{
  if (args.Error. <your code to identify it>) args.Error.ErrorHash = null;
};

Option 2 is disabling rollups globally, either in code, for example when creating an error store set the rollupSeconds to 0:

ErrorStore.Setup("MyApp", new JSONErrorStore(path: "Errors", rollupSeconds: 0));

Or if you're in the web.config it's a property on the <ErrorStore> element, like this:

<ErrorStore type="Memory" rollupSeconds="0" />
ismusidhu commented 9 years ago

Sorry if I have misunderstood you. Will doing one or both of the options, log body of the request which resulted in error?

On Sat, 13 Jun 2015 11:43 pm Nick Craver notifications@github.com wrote:

You have two already-existing options here. Option 1 would to not roll up specific errors based on the hash (which happens by default over an interval of 10 minutes). You can do this per-error by clearing the hash before it's logged if you wish. Here's how you'd do it:

ErrorStore.OnBeforeLog += (sender, args) => { if (args.Error. ) args.Error.ErrorHash = null; };

Option 2 is disabling rollups globally, either in code, for example when creating an error store set the rollupSeconds to 0:

ErrorStore.Setup("MyApp", new JSONErrorStore(path: "Errors", rollupSeconds: 0));

Or if you're in the web.config it's a property on the element, like this:

— Reply to this email directly or view it on GitHub https://github.com/NickCraver/StackExchange.Exceptional/issues/60#issuecomment-111737528 .

NickCraver commented 9 years ago

Any of those options (only need to use one) work - they all have the effect of not combining the errors at all, so you'd see separate errors in the log, each with their own dates, times, server variables, request data, etc.

IronSean commented 2 years ago

@NickCraver @ismusidhu how do you access the request body? I haven't been able to figure this out yet.

NickCraver commented 2 years ago

@IronSean logging the request body isn't something we do (it may be gone entirely when the exception is thrown) - form fields are best-effort logged (and filterable) but not raw request bodies.