improved log file writing to log all errors

This commit is contained in:
Steffen Schröder 2014-06-12 14:02:16 +02:00
parent f0e325fda0
commit b1decafc1d
3 changed files with 5 additions and 10 deletions

View File

@ -4,7 +4,6 @@
error_reporting(E_ALL);
// Run configuration
define('LOG_WRITE_CURRENT_FILE', 'ManiaControl.log'); // Write current log to extra file in base dir
define('LOG_NAME_USE_DATE', true); // Use current date as suffix for log file name in logs folder
define('LOG_NAME_USE_PID', true); // Use current process id as suffix for log file name in logs folder
define('DEV_MODE', false); // Development mode to not send error reports etc.
@ -35,15 +34,9 @@ if (LOG_NAME_USE_PID) {
}
$logFileName .= '.log';
define('LOG_FILE', $logFileName);
ini_set('error_log', LOG_FILE);
@file_put_contents(LOG_FILE, '');
// Delete old current log file
if (LOG_WRITE_CURRENT_FILE) {
$currentLogFileName = ManiaControlDir . LOG_WRITE_CURRENT_FILE;
define('LOG_CURRENT_FILE', $currentLogFileName);
@file_put_contents(LOG_CURRENT_FILE, '');
}
/**
* Log and echo the given text
*

View File

@ -1,3 +1,3 @@
#!/bin/sh
php ManiaControl.php 2>&1 &
php ManiaControl.php >ManiaControl.log 2>&1 &
echo $! > ManiaControl.pid

View File

@ -252,7 +252,9 @@ class ManiaControl implements CommandListener, TimerListener {
$command = escapeshellarg(ManiaControlDir . "ManiaControl.bat");
system($command); // TODO, windows stucks here as long controller is running
}
exit();
// Quit the old instance
$this->quit('Quitting ManiaControl to restart.');
}
/**