This script also can help you for supporting your clients because you can see what went wrong on a particular date. This can help you solve the problem faster.
Logger can be used to log PHP errors and problems instead of showing them to the visitors. This way it’s easieer for you to detect problemens in a website/application and solve them. And your visitors won’t be bothered with ugly error messages.
Features
- Print errors to screen
- Email errors to your mailbox
- Log errors to a file
- Log any specific types of errors
- Log Fatal errors
- Log uncaught exceptions
- Write a variable/string to the log file, very handy when debugging
Code example
Below you can see and example how PHP error logger is used:
// Load Error loggerinclude("LogBase.php");$LogBase = new LogBase();// Types to log$LogBase->enable_error(true, E_NOTICE);$LogBase->enable_fatal();$LogBase->enable_exception();// Log methods$LogBase->enable_method_file(true, array('path' => dirname(__FILE__) . '/log/'));$LogBase->enable_method_print();$LogBase->enable_method_mail(true, array('email' => 'myemail@mysite.com'));
Updates
v1.2.0 (30/09/2010)* Completly recodedv1.1.0 (26/10/2009)* Fixed logdir parameter
Thanks for your reply SiteBase, I have not given you enough detail as the error log and the screen error function is working OK and I have the$LogBase = new LogBase(); included.
the beginning of the scirip has the following:
include(“imageprocessor.php”);include(“LogBase.php”);//// Set up error log options//$LogBase = new LogBase(); // create a new instance of log// Types to log$LogBase->enable_error(true, E_PARSE, E_WARNING, E_ERROR);$LogBase->enable_fatal();$LogBase->enable_exception();// Log methods$LogBase->enable_method_file(true, array(‘path’ => dirname( FILE ).’/error_log/’));$LogBase->enable_method_print();// $LogBase->enable_method_mail(true, array(‘email’ => ‘myemail@website.be’));//// Global scope VARS //….
Then it lists the various subrountine functions including
function ftp_send_image1($chn1){.. pre amble..$conn_id1 = ftp_connect(FTP_SERVER1);$login_result1 = ftp_login($conn_id1, $ftp_user_name1, $ftp_user_pass1);
if ($login_result1<>1) // could not connect or login to ftp{$LogBase->Log(‘Could not connect to FTP 1 ’); // log the problem ftp_close($conn_id1); // close the FTP streamreturn $login_result1;}$upload1 = ftp_put($conn_id1, $destination_file1, $imagefile_name1, FTP _BINARY);….etc
and then the main calling script.
$error32=ftp_send_image1(‘1’);..etc
When I run this I get the
“Fatal: Call to a member function Log() on a non-object”
Can you help please?
Cheers KMiscellaneous | errors,
The method must be in lowercase so:
$LogBase->log('...');
Hi again, I tried the following that included the change you suggested as follows;
if (!$login_result1) // could not connect or login to ftp
{
$LogBase->log(‘Could not connect to FTP 1 ’) ; // log the problem
ftp_close($conn_id1); // close the FTP stream
return $login_result1;
}
and it gave the error
Logger result:
Fatal: Call to a member function log() on a non-object (/var/www/imageprocessing/push_ftp.php:83)
Hope you can help, everything else works fine, it would just be nice to ba able to log errors with the log() command.
Cheers
Geolog,
Can you email me that push_ftp.php file? You can find my email address on my website.logger,
Hi$handler->SetServer(“http://www.mywebsite.be/logserver/server.php”);$handler->SetServerPsk(“the same string as $logserver_psk”);
How do I use that function?When I used that function SetServer so cache folder do not create file **.log Looks like server.php do not runCould you fix it for me ??Thank youphp,
The log to server function is not supported anymore in the latest release of the PHP error logger.problem,
Can you please add the server logger back in. Was a really great feature. (not sure why you removed it anyways.).
Thankssupport,
I’ll see what I can do.technical,
Can I send logged error to an email? Say I wish to receive an email whenever fatal error or database server connection goes down. Does your script work this way too?
As metioned in the description: yes this is possible:
$LogBase->enable_method_mail(true, array('email' => 'myemail@mysite.com'));
also would like server logger in next update
I’d like to use the email reporting facility with this script. Does it have the following features?
- Email errors on cron job (so, do not send an email each time an error is triggered).
- Configure which types of errors are sent in email report (for example, ignore PHP STRICT errors).
I’m basically looking for configuration options for the email.
I’d be happy to code this functionality myself, is the code readily extended (e.g. did you use object oriented practices?).
Thank you.
These features are not included but there is a basic mail method included and the script is OO so it is pretty simple to extended it to fit your needs.
This Author is no longer around.
Download PHP Scripts PHP Error logger CodeCanyon Free
http://www.xvcz.com/download-php-scripts-php-error-logger-codecanyon-free/
No comments:
Post a Comment