Modify

Ticket #587 (closed enhancement: fixed)

Opened 18 months ago

Last modified 4 months ago

More detailed backtrace in debug mode (patch)

Reported by: Merkas <mk@…> Owned by: mrook
Priority: low Milestone: 2.4.10
Component: phing-core Version: 2.4.3
Keywords: exception, debug, backtrace Cc:

Description

This patch display extra exception info in debug mode (when "-debug" option used).

This may be usefull when error occured in some external tool which used by phing, e. g. in PhpDocumentor.

Currently Phing display messages like this:

[if] Error in IfTask
Execution of target "all" failed for the following reason: /home/mekras/public_html/eresus-core-trunk/build.xml:567:6: Undefined index: sourcecode

BUILD FAILED
exception 'BuildException' with message '/home/mekras/public_html/eresus-core-trunk/build.xml:567:6: Undefined index: sourcecode' in /usr/share/php5/PEAR/phing/TaskAdapter.php:61                                                
Stack trace:                                                            
#0 /usr/share/php5/PEAR/phing/Task.php(253): TaskAdapter->main()
#1 /usr/share/php5/PEAR/phing/Target.php(277): Task->perform()
#2 /usr/share/php5/PEAR/phing/Target.php(300): Target->main()
#3 /usr/share/php5/PEAR/phing/Project.php(610): Target->performTasks()
#4 /usr/share/php5/PEAR/phing/Project.php(583): Project->executeTarget('all')
#5 /usr/share/php5/PEAR/phing/Phing.php(553): Project->executeTargets(Array)
#6 /usr/share/php5/PEAR/phing/Phing.php(170): Phing->runBuild()
#7 /usr/share/php5/PEAR/phing/Phing.php(270): Phing::start(Array, NULL)
#8 /usr/share/php5/PEAR/phing.php(37): Phing::fire(Array)
#9 {main}        

And after patching will be like this:

[if] Error in IfTask
[if] #0 /usr/share/php5/PEAR/phing/tasks/ext/phpunit/PHPUnitTestRunner.php(97): PHPUnit_Util_ErrorHandler::handleError(8, 'Undefined index...', '/usr/share/php5...', 1117)
#1 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/IntermediateParser.inc(1117): PHPUnitTestRunner::handleError(8, 'Undefined index...', '/usr/share/php5...', 1117, Array)
#2 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/IntermediateParser.inc(1066): phpDocumentor_IntermediateParser->_processPageLevelDocBlock(Object(parserDocBlock))
#3 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/IntermediateParser.inc(1347): phpDocumentor_IntermediateParser->handleDocBlock(801, Object(parserDocBlock))
#4 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/Publisher.inc(106): phpDocumentor_IntermediateParser->HandleEvent(801, Object(parserDocBlock))
#5 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/phpDocumentorTParser.inc(1504): Publisher->publishEvent(801, Object(parserDocBlock))
#6 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/phpDocumentorTParser.inc(1390): phpDocumentorTParser->commonDocBlock(Array, 112, 'handleDesc')
#7 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/phpDocumentorTParser.inc(329): phpDocumentorTParser->handleDocBlock(Array, 112)
#8 /usr/share/php5/PEAR/PhpDocumentor/phpDocumentor/Setup.inc.php(752): phpDocumentorTParser->parse('<?php?/**? * Er...', '/home/mekras/pu...', 8, false)
#9 /usr/share/php5/PEAR/phing/tasks/ext/phpdoc/PhpDocumentorTask.php(369): phpDocumentor_setup->createDocs()
#10 /usr/share/php5/PEAR/phing/Task.php(253): PhpDocumentorTask->main()
#11 /usr/share/php5/PEAR/phing/tasks/system/SequentialTask.php(55): Task->perform()
#12 /usr/share/php5/PEAR/phing/tasks/system/IfTask.php(164): SequentialTask->main()
#13 /usr/share/php5/PEAR/phing/TaskAdapter.php(57): IfTask->main(Object(Project))
#14 /usr/share/php5/PEAR/phing/Task.php(253): TaskAdapter->main()
#15 /usr/share/php5/PEAR/phing/Target.php(277): Task->perform()
#16 /usr/share/php5/PEAR/phing/Target.php(300): Target->main()
#17 /usr/share/php5/PEAR/phing/Project.php(610): Target->performTasks()
#18 /usr/share/php5/PEAR/phing/Project.php(583): Project->executeTarget('all')
#19 /usr/share/php5/PEAR/phing/Phing.php(553): Project->executeTargets(Array)
#20 /usr/share/php5/PEAR/phing/Phing.php(170): Phing->runBuild()
#21 /usr/share/php5/PEAR/phing/Phing.php(270): Phing::start(Array, NULL)
#22 /usr/share/php5/PEAR/phing.php(37): Phing::fire(Array)
#23 {main}
Execution of target "all" failed for the following reason: /home/mekras/public_html/eresus-core-trunk/build.xml:567:6: Undefined index: sourcecode

BUILD FAILED
exception 'BuildException' with message '/home/mekras/public_html/eresus-core-trunk/build.xml:567:6: Undefined index: sourcecode' in /usr/share/php5/PEAR/phing/TaskAdapter.php:61
Stack trace:
#0 /usr/share/php5/PEAR/phing/Task.php(253): TaskAdapter->main()
#1 /usr/share/php5/PEAR/phing/Target.php(277): Task->perform()
#2 /usr/share/php5/PEAR/phing/Target.php(300): Target->main()
#3 /usr/share/php5/PEAR/phing/Project.php(610): Target->performTasks()
#4 /usr/share/php5/PEAR/phing/Project.php(583): Project->executeTarget('all')
#5 /usr/share/php5/PEAR/phing/Phing.php(553): Project->executeTargets(Array)
#6 /usr/share/php5/PEAR/phing/Phing.php(170): Phing->runBuild()
#7 /usr/share/php5/PEAR/phing/Phing.php(270): Phing::start(Array, NULL)
#8 /usr/share/php5/PEAR/phing.php(37): Phing::fire(Array)
#9 {main}

Attachments

TaskAdapter.php.patch Download (409 bytes) - added by Merkas <mk@…> 18 months ago.

Change History

Changed 18 months ago by Merkas <mk@…>

comment:1 Changed 18 months ago by mrook

  • Milestone set to 2.4.4

comment:2 Changed 18 months ago by mrook

You only want a detailed backtrace when errors occur in tasks wrapped by TaskAdapter?

comment:3 Changed 15 months ago by mrook

  • Status changed from new to infoneeded_new
  • Milestone changed from 2.4.5 to TBD

comment:4 Changed 15 months ago by mk@…

I don't know about other wrappers. This case I have found in experimental way when I got into trouble.

comment:5 Changed 7 months ago by mrook

  • Status changed from infoneeded_new to new

Please add an example build file to demonstrate a use case.

comment:6 Changed 4 months ago by mrook

  • Milestone changed from TBD to 2.4.10

comment:7 Changed 4 months ago by Michiel Rook

  • Status changed from new to closed
  • Resolution set to fixed

Fixes #587 - log detailed exception backtrace

Changeset: 6be12aee44fedf2bc757bb0fcefdc317922d14df

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.