PHP logging

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tinks
Forum Newbie
Posts: 5
Joined: Mon Oct 18, 2010 2:32 am

PHP logging

Post by tinks »

hi,

i am new with php and hope that you guys could help me with my prob.
i am working on the logging for my work.
i wanted to use log4php.
I copied this configuration online, and named the file

log4php.properties
----------------------
log4php.rootLogger=INFO, LOGFILE
log4php.appender.LOGFILE=LoggerAppenderFile
log4php.appender.LOGFILE.name="test.log"
log4php.appender.LOGFILE.layout=LoggerPatternLayout
log4php.appender.LOGFILE.layout.ConversionPattern="%d{Y-m-d H:i:s} %F %p %m %n"
----------------------

in my php code i have:
--------------------

Code: Select all

<?php
include 'opendb.php';

require_once '../log4php/LoggerManager.php';
require_once '../log4php/LoggerPropertyConfigurator.php';

$ID = $_GET['info'];
$result = mysql_query("SELECT * FROM userTable WHERE IDname='" . $ID . "'"); 
$rnum=mysql_num_rows($result);
echo "alert(\"" . $rnum . "\");";

$logger =& LoggerManager::getRootLogger();
$logger->info($_SERVER['REMOTE_ADDR']);
$logger->info("tesing123");

...some php codes..

?>
i am on Linux using Apache and mysql. the configuration above was supposed to
create a file for the log. however, it cannot create a file. i've been searching
pretty hard on this and tried several config examples but still i could not
get it to write to a log file..

is there something that i forgot to do?
please help..

thanks alot.
tinks :)
Post Reply