Skip to content

Document PHP developer debugging / troubleshooting techniques #254

Description

@chrisinmtown

Document ways to see what the MISP PHP code is doing. All of the following require modifying php files:

(1) Change MISP server setting Security.debug from 0 to 1 or (caution) 2; then use function debug(). But as @iglocska points out, this will start pasting the debug messages directly in the pages you query and the API will include them too (be careful, the result will be invalid JSON for obvious reasons)

(2) Change MISP server setting Security.admin_debug from 0 to 1. But this is black magic to me and might be buggy, see MISP/MISP#7131

(3) Write information directly to a file with this function:

file_put_contents('/path/to/output/file', json_encode($myvar) . PHP_EOL, FILE_APPEND));

(4) Use PHP method like this:

CakeLog::write('debug', 'Got here');

as described here:

https://book.cakephp.org/2/en/development/debugging.html#using-logging-to-debug

CakeLog is enabled by the following statement in /var/www/MISP/app/Config/bootstrap.php; it's present in bootstrap.default.php in the tip of "main" branch, double-check your instance to be sure:

App::uses('CakeLog', 'Log');

Gitter discussion here:

https://gitter.im/MISP/Support?at=605c80ba9ebdfd1640998e56

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: enhancementType: enhancement. This issue seeks an improvement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions