error-logging

Can the ASP.NET Yellow Screen of Death (YSOD) be generated on demand or captured?

别来无恙 提交于 2019-11-29 10:29:33
问题 We'd like to just capture the YSOD output to use in an erorr reporting email, from a Global.asax error handler, for instance. Is there any way of leveraging the built-in ysod generator? 回答1: Yes there is a way that you can do this. In the Application_Error event in the global.asax file, get the last exception as an System.HttpUnhandledException. Your code will look like this: var lastException = Server.GetLastError() as HttpUnhandledException; string Ysod = lastException.GetHtmlErrorMessage()

Detecting console.log() calls

随声附和 提交于 2019-11-29 10:28:46
问题 I'm trying to write a test case for a debugging method that writes messages to the JavaScript console using console.log() . The test has to check that the message has been successfully written to the console. I'm using jQuery. Is there a way to attach a hook to console.log() or otherwise check that a message has been written to the console, or any other suggestions on how to write the test case? 回答1: console.log doesn't keep a record of messages that are logged, or emit any events that you

Is it possible to specify custom error log format in nginx?

孤者浪人 提交于 2019-11-29 02:55:40
I can specify custom log format for access log in nginx, but it won't work for error log. I wish I always saw time when error occur. Is it possible? CyberDem0n You can't specify your own format, but in nginx build-in several level's of error_log-ing. Syntax: error_log file [ debug | info | notice | warn | error | crit ] Default: ${prefix}/logs/error.log Specifies the file where server (and fastcgi) errors are logged. Default values for the error level: in the main section - error in the HTTP section - crit in the server section - crit In my error_log, time always presented int begin of each

PHP CLI won't log errors

霸气de小男生 提交于 2019-11-28 17:47:29
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? George Cummins 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 This question and answer thread was very helpful to me while setting up PHP CLI logging on an Ubuntu 12.04 environment, so I wanted to post an answer that distills what

Best Practices for Error Logging and/or reporting for iPhone

穿精又带淫゛_ 提交于 2019-11-28 15:18:32
When I do web development, I use a custom made logger that catches fatal errors and appends a trace to a file and displays a message to the user. I can occasionally glance to see if the file changed, which means, some user encountered an error and I can dig in to see what they encountered. I'd like something similar on the iphone, with some caveats: While developing, it should be trivial to reset the list of errors or turn off notification. While developing, the error messages should also show up in some obvious place, like on the screen on in the console Once deployed, errors should politely

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

大城市里の小女人 提交于 2019-11-28 09:10:33
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 relevant file name (the error message would be: "ERROR while reading file ***: …" instead of "ERROR: …").

PHP log will not ignore repeated errors with ignore_repeated_errors = On

微笑、不失礼 提交于 2019-11-28 04:48:03
问题 Although I have instructed php to only log an error once - i see the error over and over again in my log file. Any ideas why this directive would get ignored? I've restarted apache, etc. 回答1: This directive will only stop the error from being logged again within the same script run . When the same script is run multiple times, you will still see that error every time. 回答2: Besides the ignore_repeated_errors , there is also the ignore_repeated_source ini settings. I think that one would work

How to enable loglevel debug on Apache2 server [closed]

ぃ、小莉子 提交于 2019-11-28 04:18:00
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 internet I've found plenty of explanations of loglevel and mod_rewrite, but not a word of how to make

Adding properties to log message in NLog in .net core

半城伤御伤魂 提交于 2019-11-28 03:57:55
问题 I am using NLog for logging messages in .net core. I have added NLog in StartUp.cs as follows: loggerFactory.AddNLog(); For logging to file, I am using following method: logger.LogInformation("Message"); I want to add custom NLog event properties to my message. But LogInformation() is not allowing me to pass that. How can I do that? 回答1: If you want custom layout properties (NLog calls them layout renderers) you can use the EventProperties Layout Renderer. You can simply do this in your code:

Is it possible to specify custom error log format in nginx?

好久不见. 提交于 2019-11-27 17:27:13
问题 I can specify custom log format for access log in nginx, but it won't work for error log. I wish I always saw time when error occur. Is it possible? 回答1: You can't specify your own format, but in nginx build-in several level's of error_log-ing. Syntax: error_log file [ debug | info | notice | warn | error | crit ] Default: ${prefix}/logs/error.log Specifies the file where server (and fastcgi) errors are logged. Default values for the error level: in the main section - error in the HTTP