How to enable loglevel debug on Apache2 server [closed]

Do note that on newer Apache versions the RewriteLog and RewriteLogLevel have been removed, and in fact will now trigger an error when trying to start Apache (at least on my XAMPP installation with Apache 2.4.2): AH00526: Syntax error on line xx of path/to/config/file.conf: Invalid command ‘RewriteLog’, perhaps misspelled or defined by a module not … Read more

Error logging in C#

Lots of log4net advocates here so I’m sure this will be ignored, but I’ll add my own preference: System.Diagnostics.Trace This includes listeners that listen for your Trace() methods, and then write to a log file/output window/event log, ones in the framework that are included are DefaultTraceListener, TextWriterTraceListener and the EventLogTraceListener. It allows you to specify … Read more

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

Yes. This error is a structured exception that wasn’t mapped into a .NET error. It’s probably your DataGrid mapping throwing a native exception that was uncaught. You can tell what exception is occurring by looking at the ExternalException.ErrorCode property. I’d check your stack trace, and if it’s tied to the DevExpress grid, report the problem … Read more

“[notice] child pid XXXX exit signal Segmentation fault (11)” in apache error.log [closed]

Attach gdb to one of the httpd child processes and reload or continue working and wait for a crash and then look at the backtrace. Do something like this: $ ps -ef|grep httpd 0 681 1 0 10:38pm ?? 0:00.45 /Applications/MAMP/Library/bin/httpd -k start 501 690 681 0 10:38pm ?? 0:00.02 /Applications/MAMP/Library/bin/httpd -k start … Now … Read more

How to use ELMAH to manually log errors

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); } There is a difference between the two solutions: Raise method applies ELMAH filtering rules to the exception. Log method … Read more

Error handling in Bash [closed]

Use a trap! tempfiles=( ) cleanup() { rm -f “${tempfiles[@]}” } trap cleanup 0 error() { local parent_lineno=”$1″ local message=”$2″ local code=”${3:-1}” if [[ -n “$message” ]] ; then echo “Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}” else echo “Error on or near line ${parent_lineno}; exiting with status ${code}” fi exit … Read more

Print PHP Call Stack

More readable than debug_backtrace(): $e = new \Exception; var_dump($e->getTraceAsString()); #2 /usr/share/php/PHPUnit/Framework/TestCase.php(626): SeriesHelperTest->setUp() #3 /usr/share/php/PHPUnit/Framework/TestResult.php(666): PHPUnit_Framework_TestCase->runBare() #4 /usr/share/php/PHPUnit/Framework/TestCase.php(576): PHPUnit_Framework_TestResult->run(Object(SeriesHelperTest)) #5 /usr/share/php/PHPUnit/Framework/TestSuite.php(757): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult)) #6 /usr/share/php/PHPUnit/Framework/TestSuite.php(733): PHPUnit_Framework_TestSuite->runTest(Object(SeriesHelperTest), Object(PHPUnit_Framework_TestResult)) #7 /usr/share/php/PHPUnit/TextUI/TestRunner.php(305): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false) #8 /usr/share/php/PHPUnit/TextUI/Command.php(188): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array) #9 /usr/share/php/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true) #10 /usr/bin/phpunit(53): PHPUnit_TextUI_Command::main() #11 {main}”

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

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 the default stderr) and adding it to the root logger: import logging import sys root = logging.getLogger() root.setLevel(logging.DEBUG) handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.DEBUG) formatter = logging.Formatter(‘%(asctime)s – %(name)s – … Read more