[TYPO3-english] How can I include logging with that script
Ronald Wiplinger (Lists)
ronald_lists at elmit.com
Sun Oct 12 02:02:27 CEST 2008
brief history:
I cannot login anymore (not with admin, not as user). I cannot add an
admin account via the Install tool (ERROR cannot insert record). I can
access the database via command line mysql and via phpmyadmin. I can
write to the database.
The webhoster has NO log access and gave me this script to "prepend" /
include into my php files. Where/how should I add this lines? I tried to
create a logme.php with the code and used in index.php,
install/index.php an include statement, but it failed because I used
relative addressing and the index.php's are via ln -s links ... so I
used the complete path to the logme.php, but failed also.
error_reporting(0);
$old_error_handler = set_error_handler("userErrorHandler");
function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars)
{
$time=date("d M Y H:i:s");
// Get the error type from the error number
$errortype = array (1 => "Error",
2 => "Warning",
4 => "Parsing Error",
8 => "Notice",
16 => "Core Error",
32 => "Core Warning",
64 => "Compile Error",
128 => "Compile Warning",
256 => "User Error",
512 => "User Warning",
1024 => "User Notice");
$errlevel=$errortype[$errno];
//Write error to log file (CSV format)
$errfile=fopen("errors.csv","a");
fputs($errfile,"\"$time\",\"$filename:
$linenum\",\"($errlevel) $errmsg\"\r\n");
fclose($errfile);
if($errno!=2 && $errno!=8) {
//Terminate script if fatal error
die("A fatal error has occurred. Script execution has been aborted");
}
IF that would work, somehow I would propose to add this into the code (if you need it rename the code file to logme.php)
bye
Ronald
}
More information about the TYPO3-english
mailing list