error-logging

Error logging in C#

依然范特西╮ 提交于 2019-11-27 16:47:56
I am making my switch from coding in C++ to C#. I need to replace my C++ error logging/reporting macro system with something similar in C#. In my C++ source I can write LOGERR("Some error"); or LOGERR("Error with inputs %s and %d", stringvar, intvar); The macro & supporting library code then passes the (possibly varargs) formatted message into a database along with the source file, source line, user name, and time. The same data is also stuffed into a data structure for later reporting to the user. Does anybody have C# code snippets or pointers to examples that do this basic error reporting

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

半城伤御伤魂 提交于 2019-11-27 11:44:46
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 usually means that someone relating to the computer is not working as expected. They were unable to give me

Use Rack::CommonLogger in Sinatra

半城伤御伤魂 提交于 2019-11-27 11:03:13
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. Roman Gonzalez Rack::CommonLogger won't provide a logger to your main app, it will just logs the request like Apache would do

PHP CLI won't log errors

坚强是说给别人听的谎言 提交于 2019-11-27 10:45:40
问题 PHP currently will not log errors produced from the command line. I have : log_errors = On error_log = /var/log/php_errors.log in /etc/php5/cli/php.ini Am I missing a further setting to get this working? 回答1: Please check that the user account running PHP CLI has write access to /var/log/php_errors.log . Additionally, you can verify that you are using the correct php.ini file like this: php -a -c /etc/php5/cli/php.ini 回答2: This question and answer thread was very helpful to me while setting

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

岁酱吖の 提交于 2019-11-27 09:25:42
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 raw HTTP request with JSON as the request body: PUT http://mycompany.com/api/v1.0/me HTTP/1.1 Host:

How to change the format of logged messages temporarily, in Python?

微笑、不失礼 提交于 2019-11-27 02:43:05
问题 What is the simplest method for temporarily changing the logging message format, in Python (through the logging module)? The goal is to have some standard message format, while being able to temporarily add information about some file being read (like its name); the message format should revert to its default when the file is not being read anymore. The program that produces the messages is not aware of what file is being read, so it would be nice if its message automatically included the

How to enable loglevel debug on Apache2 server [closed]

狂风中的少年 提交于 2019-11-27 00:19:45
问题 My error.log contains: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. I replaced loglevel on apache config file: LogLevel debug After restarting, I'm getting the same error message without what could be called "a backtrace". As I understand there should be those 10 lines of redirects generated by mod_rewrite regex. After searching all over the

Error logging in C#

南笙酒味 提交于 2019-11-26 22:29:32
问题 I am making my switch from coding in C++ to C#. I need to replace my C++ error logging/reporting macro system with something similar in C#. In my C++ source I can write LOGERR("Some error"); or LOGERR("Error with inputs %s and %d", stringvar, intvar); The macro & supporting library code then passes the (possibly varargs) formatted message into a database along with the source file, source line, user name, and time. The same data is also stuffed into a data structure for later reporting to the

Internal Error 500 Apache, but nothing in the logs?

扶醉桌前 提交于 2019-11-26 19:57:33
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? The default error log as opposed to the scripts error logs usually has the (more) specific error. often it will be permissions denied or even an interpreter that can't be found. This means the fault almost always lies with your script. e.g you

Print PHP Call Stack

China☆狼群 提交于 2019-11-26 19:16:51
I'm looking for a way to print the call stack in PHP. Bonus points if the function flushes the IO buffer. 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) { ["file"] => string(10) "/tmp/b.php" ["line"] => int(2) ["args"] => array(1) { [0] => string(10) "/tmp/a.php" } [