Reputation: 146
I have this debug function to show runtime errors and some messages.
/**
* Debug logs
* @param string $msg Log message
*/
function logMsg(?string $msg)
{
error_reporting(E_ALL);
ini_set('ignore_repeated_errors', true);
ini_set('display_errors', false);
ini_set('log_errors', true);
ini_set("error_log", SERVER_ROOT . "debug.log");
if (DEBUG_MODE) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$caller = array_shift($bt);
$File = basename($caller["file"]);
$Line = $caller['line'];
error_log("$msg [$File On line $Line]");
}
}
This works well on local but now that I deploy my web-app on digital ocean droplet the errors are being printed in /var/log/apache2/error.log
instead of myapp/debug.log
.
I want to know if there is something more I have to do to set this function to work properly?
Upvotes: 1
Views: 15