Page 1 of 1

How to activate debug mode ?

Posted: 2025-04-07 16:32
by A Bindi
I create a file named settings.php in the application root folder containing:

Code: Select all

<?php
$debug_mode = true;
it doesn’t seem to work :(

ALex.

Re: How to activate debug mode ?

Posted: 2025-04-07 16:54
by jsetzer
I create a file named settings.php in the application root folder [...] it doesn’t seem to work :(
What exactly does not work? Creating the file? Including the file in your PHP Script? Evaluating the value or your variable for your own logging-scripts? Are there any error messages/exceptions?

Did you include('CORRECT_PATH/settings.php');?

Just placing a file somewhere will not load it between REQUEST and RESPONSE. You have to include('...') or require('...') that file.

Alternatively, create hooks/__bootstrap.php, if not already exists, declare your variable there. That specific file gets loaded automatically by AppGini generated code. Note: at this place you don't have any library functions available, yet, because loading __bootstrap.php takes place just after REQUEST.

Or place your variable declaration in hooks/header-extras.php.

After including your settings.php your variable should be available. You can check it with var_dump($debug_mode); exit; for example. This should print out true.

Re: How to activate debug mode ?

Posted: 2025-04-08 13:01
by A Bindi
Thank you for reply.
Due very slow queries I would want to activate the Appgini debug mode and I read somewhere to edit the file <webroot>\settings.php adding the string:

<?php
$debug_mode = true;

In my installation there was no that file so I created it, edited and saved, but the debug mode does not seem to work, or maybe I did not understand how it works.

ALex.

Re: How to activate debug mode ?

Posted: 2025-04-08 15:01
by jsetzer
[...] activate the Appgini debug mode and I read somewhere [...]
in definitions.php there is a constant named DEBUG_MODE. Perhaps this is what you have seen?!

According to function-description, you can set that constant to true and use built-in breakpoint(...)-function within your PHP code. This will write a file named breakpoint.csv in /WEBROOT/YOUR_APP_PATH/admin/-subdirectory with your specific debug information.

Re: How to activate debug mode ?

Posted: 2025-04-09 06:40
by jsetzer
I should have mentioned that definitions.php gets overwritten on next code generation.

I may be wrong, but I don't see any project specific setting in AppGini project itself nor in Admin area, which, from my point of view, would be nice to have.

Anyway, for efficient logging, debugging or error-tracing you may consider using a third-party tool or write your own logging-class.

Just my 2 cents.