error-logging

Elmah: How to get JSON HTTP request body from error report

心已入冬 提交于 2019-11-26 17:49:55
问题 I'm using Elmah to log exceptions. Elmah is great at logging request bodies if the request is a Form-based request (i.e. Content-Type: application/x-www-form-urlencoded), but with JSON based requests where the content type is application/json, the request body is nowhere to be found in the error reports. Anyone know where I can find this request body so that I can properly diagnose my exceptions? UPDATE: 2012-01-03 As a clarification on what I mean by JSON based requests, here's an example

How do you log server errors on django sites

∥☆過路亽.° 提交于 2019-11-26 16:52:10
So, when playing with the development I can just set settings.DEBUG to True and if an error occures I can see it nicely formatted, with good stack trace and request information. But on kind of production site I'd rather use DEBUG=False and show visitors some standard error 500 page with information that I'm working on fixing this bug at this moment ;) At the same time I'd like to have some way of logging all those information (stack trace and request info) to a file on my server - so I can just output it to my console and watch errors scroll, email the log to me every hour or something like

How to use ELMAH to manually log errors

怎甘沉沦 提交于 2019-11-26 15:36:42
Is it possible to do the following using ELMAH? logger.Log(" something"); I'm doing something like this: try { // Code that might throw an exception } catch(Exception ex) { // I need to log error here... } This exception will not be automatically logged by ELMAH, because it was handled. Andrey Kamaev Direct log writing method, working since ELMAH 1.0: try { some code } catch(Exception ex) { Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(ex)); } ELMAH 1.2 introduces a more flexible API: try { some code } catch(Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex);

How should you diagnose the error SEHException - External component has thrown an exception

大憨熊 提交于 2019-11-26 15:36:38
问题 Whenever a user reports an error such as System.Runtime.InteropServices.SEHException - External component has thrown an exception? is there anything that I as a programmer can do to determine the cause? Scenario : One user (using a program my company wrote) has reported this error. This may or may not have been a one off error. They mentioned that in the last month, the computer has twice 'stopped working'. I have learnt from experience, not to take this description too literally, as it

Use Rack::CommonLogger in Sinatra

放肆的年华 提交于 2019-11-26 15:24:46
问题 I have a small web-server that I wrote with Sinatra. I want to be able to log messages to a log file. I've read through http://www.sinatrarb.com/api/index.html and www.sinatrarb.com/intro.html, and I see that Rack has something called Rack::CommonLogger, but I can't find any examples of how it can be accessed and used to log messages. My app is simple so I wrote it as a top-level DSL, but I can switch to subclassing it from SinatraBase if that's part of what's required. 回答1: Rack:

Making Python loggers output all messages to stdout in addition to log file

拜拜、爱过 提交于 2019-11-26 10:59:12
Is there a way to make Python logging using the logging module automatically output things to stdout in addition to the log file where they are supposed to go? For example, I'd like all calls to logger.warning , logger.critical , logger.error to go to their intended places but in addition always be copied to stdout . This is to avoid duplicating messages like: mylogger.critical("something failed") print "something failed" All logging output is handled by the handlers; just add a logging.StreamHandler() to the root logger. Here's an example configuring a stream handler (using stdout instead of

Internal Error 500 Apache, but nothing in the logs?

帅比萌擦擦* 提交于 2019-11-26 07:28:58
问题 I\'m getting 500 Internal Server errors when I try to make an HTTP POST to a specific address in my app. I\'ve looked into the server logs in the custom log directory specified in the virtual hosts file, but the error doesn\'t show up there so debugging this has been a pain in the ass. How do I cause Apache to log Internal 500 errors into the error log? 回答1: The default error log as opposed to the scripts error logs usually has the (more) specific error. often it will be permissions denied or

Print PHP Call Stack

纵然是瞬间 提交于 2019-11-26 06:51:44
问题 I\'m looking for a way to print the call stack in PHP. Bonus points if the function flushes the IO buffer. 回答1: If you want to generate a backtrace, you are looking for debug_backtrace and/or debug_print_backtrace . The first one will, for instance, get you an array like this one (quoting the manual) : array(2) { [0]=> array(4) { ["file"] => string(10) "/tmp/a.php" ["line"] => int(10) ["function"] => string(6) "a_test" ["args"]=> array(1) { [0] => &string(6) "friend" } } [1]=> array(4) { [

How to use ELMAH to manually log errors

柔情痞子 提交于 2019-11-26 05:56:57
问题 Is it possible to do the following using ELMAH? logger.Log(\" something\"); I\'m doing something like this: try { // Code that might throw an exception } catch(Exception ex) { // I need to log error here... } This exception will not be automatically logged by ELMAH, because it was handled. 回答1: Direct log writing method, working since ELMAH 1.0: try { some code } catch(Exception ex) { Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(ex)); } ELMAH 1.2 introduces a more

How do you log server errors on django sites

帅比萌擦擦* 提交于 2019-11-26 04:57:23
问题 So, when playing with the development I can just set settings.DEBUG to True and if an error occures I can see it nicely formatted, with good stack trace and request information. But on kind of production site I\'d rather use DEBUG=False and show visitors some standard error 500 page with information that I\'m working on fixing this bug at this moment ;) At the same time I\'d like to have some way of logging all those information (stack trace and request info) to a file on my server - so I can