You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by tinkee <le...@gmail.com> on 2010/12/13 04:53:03 UTC
log4php problem
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:
------------------
<?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..
and also, Im kind of confused, whats the difference between the:
1) apache-log4php-2.0.0-incubating
2) log4php-0.9
log4php installers? and which one should I be using?
currently, with the config above i am on log4php-0.9..
thanks a lot.
tinks :(
--
View this message in context: http://old.nabble.com/log4php-problem-tp30442440p30442440.html
Sent from the Log4php - Dev mailing list archive at Nabble.com.
Re: log4php problem
Posted by tinkee <le...@gmail.com>.
Helo Christian,
Thanks a lot for the reply.
I tried the codes below still would not woekr.
However i found out that log4php require rphp 5.2?
Becaue realized Im using php php 5.1..
could that probably be the reason why its not working?
thanks a lot,,
tinks
Christian grobmeier wrote:
>
> Hello,
>
> please upgrade to 2.0.0-incuating version. Its the latest one and the
> only one which has been released by Apache. 0.9 was prior Apache days.
>
>> include 'opendb.php';
>>
>
> require_once ('log4php/Logger.php');
> //only once!
> Logger::configure('myconfiguration.properties');
>
>>
>> $ID = $_GET['info'];
>> $result = mysql_query("SELECT * FROM userTable WHERE IDname='" . $ID .
>> "'");
>> $rnum=mysql_num_rows($result);
>> echo "alert(\"" . $rnum . "\");";
>>
>
> $logger = Logger::getLogger('MyApp');
> $logger->info('Hello!');
>
> Let me know if that helped you
> Cheers
> Christian
>
>> ...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..
>>
>>
>> and also, Im kind of confused, whats the difference between the:
>>
>> 1) apache-log4php-2.0.0-incubating
>> 2) log4php-0.9
>>
>> log4php installers? and which one should I be using?
>> currently, with the config above i am on log4php-0.9..
>>
>>
>>
>>
>> thanks a lot.
>> tinks :(
>> --
>> View this message in context:
>> http://old.nabble.com/log4php-problem-tp30442440p30442440.html
>> Sent from the Log4php - Dev mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> http://www.grobmeier.de
>
>
--
View this message in context: http://old.nabble.com/log4php-problem-tp30442440p30451438.html
Sent from the Log4php - Dev mailing list archive at Nabble.com.
Re: log4php problem
Posted by Christian Grobmeier <gr...@gmail.com>.
Hello,
please upgrade to 2.0.0-incuating version. Its the latest one and the
only one which has been released by Apache. 0.9 was prior Apache days.
> include 'opendb.php';
>
require_once ('log4php/Logger.php');
//only once!
Logger::configure('myconfiguration.properties');
>
> $ID = $_GET['info'];
> $result = mysql_query("SELECT * FROM userTable WHERE IDname='" . $ID . "'");
> $rnum=mysql_num_rows($result);
> echo "alert(\"" . $rnum . "\");";
>
$logger = Logger::getLogger('MyApp');
$logger->info('Hello!');
Let me know if that helped you
Cheers
Christian
> ...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..
>
>
> and also, Im kind of confused, whats the difference between the:
>
> 1) apache-log4php-2.0.0-incubating
> 2) log4php-0.9
>
> log4php installers? and which one should I be using?
> currently, with the config above i am on log4php-0.9..
>
>
>
>
> thanks a lot.
> tinks :(
> --
> View this message in context: http://old.nabble.com/log4php-problem-tp30442440p30442440.html
> Sent from the Log4php - Dev mailing list archive at Nabble.com.
>
>
--
http://www.grobmeier.de