adding logging to gallery

r3v3ng

Joined: 2002-10-06
Posts: 1
Posted: Sun, 2002-10-06 12:40

For all you paranoid gallery admins out there, just add the following snippet of code to util.php...

// ---------------
function write2log($logString) {
global $GALLERY_BASEDIR;
$fp = fopen ($GALLERY_BASEDIR . "log/gallery.log", "a");
fwrite($fp, $logString."n");
fclose ($fp);
}
// ---------------

then just call write2log("Some log message goes here"); from each function you want to log.

remember that the log directory must exist under the gallery basedir and be writeble by the webserver user. the gallery.log file will be created on first use.

I have tested this on my own systems and it works fine.

Obviously this requires some knowledge of php :grin: