CodeCanyon

PHP Error logger

  • Has been a member for 1-2 years
  • Bought between 10 and 49 items
geostationary says
Purchased

Nice script as ever, saved me days of coding. Can you help with this error

“Fatal: Call to a member function Log() on a non-object”

when I write

if ($login_result1==1) { $LogBase->Log(‘Could not connect to FTP 1 ’); }

any ideas?

1 year ago
Author
Sitebase Sitebase replied

You get that errror because you didn’t create an instance of the LogBase class. Make sure you add the lines from the documentation where I configure the LogBase:

$LogBase = new LogBase();
...
...
...
1 year ago
  • Has been a member for 1-2 years
  • Bought between 10 and 49 items
geostationary says
Purchased

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 stream return $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 K

1 year ago
Author
Sitebase Sitebase replied

The method must be in lowercase so:

$LogBase->log('...');
1 year ago
  • Has been a member for 1-2 years
  • Bought between 10 and 49 items
geostationary says
Purchased

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

Geo

1 year ago
Author
Sitebase Sitebase replied

Can you email me that push_ftp.php file? You can find my email address on my website.

1 year ago
  • Has been a member for 1-2 years
  • Bought between 1 and 9 items
  • Vietnam
kimanhtuan says

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 run Could you fix it for me ?? Thank you

1 year ago
Author
Sitebase Sitebase replied

The log to server function is not supported anymore in the latest release of the PHP error logger.

1 year ago
  • Has been a member for 2-3 years
  • Bought between 100 and 499 items
  • United States
Wicked_DFG says
Purchased

Can you please add the server logger back in. Was a really great feature. (not sure why you removed it anyways.).

Thanks

1 year ago
Author
Sitebase Sitebase replied

I’ll see what I can do.

1 year ago
  • Has been a member for 1-2 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Referred between 10 and 49 users
amzee says

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?

1 year ago
Author
Sitebase Sitebase replied

As metioned in the description: yes this is possible:

$LogBase->enable_method_mail(true, array('email' => 'myemail@mysite.com'));
1 year ago
  • Has been a member for 1-2 years
  • Exclusive Author
  • Bought between 50 and 99 items
caston says
Purchased

also would like server logger in next update

11 months ago
  • Has been a member for 1-2 years
  • Bought between 50 and 99 items
conorcan says

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.

5 months ago
Author
Sitebase Sitebase replied

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.

4 months ago
by
by
by
by
by