|
Newest Member
|
|---|
| walkaround64 | |
| cool Statistics |
| | coolcommands: | 1271 | | Categories: | 82 | | Total queries: | 444921 | | Members: | 3196 | |
|
|
|
 |
|
|
Search coolcommands.com
 |
Submitted by:
lvo   |
coolcommand
log.php - php include file to do logging to a text file |
Description
This is a PHP include file which does logging of messages to a central logfile. You can use it in all your applications to avoid writing the same code over and over.
Some things to change are:
1) Path and name of logfile 2) Create the logfile before using this function 3) Ensure the file is writable by the user your web server runs as (usually nobody)
To include this file in your PHP pages when you want to do logging, simpy add this line at the top of your PHP page:
require('log.php');
To call the logging function, use this line in your PHP page:
log_action("Your logging message here.\n");
Include code for log.php:
<?php
function log_action($msg) { if ($fp = @fopen("/var/lib/mysql/php_app.log", "a")) { fwrite($fp, $msg, strlen($msg)); fclose($fp); } } ?>
NOTE: You can also use variables from your PHP page in the logfile message text. |
Example
log.php |
Return to search results
 |  |  |  |
Random coolcommands
coolcommand: newfs - how to create a filesystem on a metadevice in Solaris Volume Manager
Example: newfs -i 8192 /dev/md/rdsk/d0
[show me the details] |
coolcommand: lspv - to get information about physical volumes in IBM AIX
Example: lspv
[show me the details] |
coolcommand: mqver - how to determine Websphere MQ version, service level, buildtype and build date
Example: mqver
[show me the details] |
coolcommand: mqrc - convert a Websphere MQ exit code to the string name of the error
Example: mqrc 0
[show me the details] |
|
|
coolcommands.com - the search engine for UNIX sysadmins :: unix commands and scripts
|  |  |  |  |
|
|
|
|
 |
|
|
|
Top 5 Submitters
|
|---|
| lvo | 1102 |
| audet | 37 |
| kah00na | 28 |
| Mariom | 24 |
| lebjf000 | 13 |
Top 5 Searches
|
| Category Solaris | 35017 |
| Category AIX | 28760 |
| Category General UNIX | 27308 |
| solaris | 17499 |
| aix | 16314 |
|
|
|
|