PHP - log anything - Joomla & VirtueMart Tips & How To's

GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.

Home Joomla - VirtueMart Virtuemart 4 & 3 Omniva Shipping Plugin

Sun

12

Nov

  • PHP
  • Log Anything

Logging is very useful!!! :)

//Write action to txt log
$log = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
"Connection: ".print_r($connection).PHP_EOL.
"Request: ".print_r($request,true).PHP_EOL.
"Response: ".print_r($response,true).PHP_EOL.
"-------------------------".PHP_EOL;
//-
#print 'Debug Line '.__LINE__.' $log <pre>'; print_r ($log); print "</pre><br />\n";
// one level higher dirname(__DIR__, 1)
$fp = fopen(dirname(__DIR__).'/LOGS/ST_log'.date("j.n.Y").'.txt', 'a+');
fwrite( $fp, $log );
fwrite($fp, "\n\n###########################################\n\n");
fclose($fp);
Last Updated on Tuesday, 20 April 2021 12:58
 



PHP - log anything|Joomla & VirtueMart Tips & How To's



GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.


log, print, php, eol, fwrite, request, response, dir, dirname, line, true, connection, date, txt, fopen, useful, write, logs, fclose, logging, action, level, server, remote, addr, debug, user, higher


guru

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.