Skip to content

Einfache Logger unter PHP

PHP

Es gibt für PHP ja so einige Möglichkeiten, Logs zu erzeugen. Apache Log4PHP dürfte die bekannteste sein, aber ich suchte etwas ganz einfaches und habe KLogger gefunden.

Einfaches Beispiel:

$log = new KLogger('/var/log/'); # Specify the log directory
$log->logInfo('Returned a million search results'); //Prints to the log file
$log->logFatal('Oh dear.'); //Prints to the log file
$log->logInfo('Here is an object', $obj); //Prints to the log file with a dump of the object

Ideal für meinen Einsatzzweck und in wenigen Minuten implementiert.

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
BBCode format allowed
You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Form options
tweetbackcheck cronjob