logging-log4php-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tinkee <lee.tinki.ti...@gmail.com>
Subject Re: log4php not working properly
Date Tue, 04 Jan 2011 08:39:32 GMT


i tried to hardcode the path in fopen("/var/www/html/logs/20110104.log",
'w');
but still cannot create though.. 



tinkee wrote:
> 
> 
> 
> iam on php 5.1.6...
> 
> i also noticed that in the echo result in line 69 of AppenderFile, the one
> you told me earlier,
> the value is only: /var/www/html/logs/
> 
> and not the same value that was passed in getFile() which was:
> /var/www/html/logs/20110104.log
> 
> the filename itself was not carried over..
> 
> you think something went wrong?
> 
> thanks a lot for all the ideas. big help. :)
> 
> 
> 
> Christian grobmeier wrote:
>> 
>> actually i am lack of ideas now... what php version are u using exaclty?
>> 
>> On Tue, Jan 4, 2011 at 9:15 AM, tinkee <lee.tinki.tinki@gmail.com> wrote:
>>>
>>>
>>> and also i am operating as root...
>>>
>>>
>>>
>>> tinkee wrote:
>>>>
>>>>
>>>> i set the whole /var/www/html/ to 777 using the terminal..:(
>>>> i think after creating the file, it does not set it to 755?
>>>> i tried to insert
>>>>
>>>> chmod($filename, 0755);
>>>>
>>>> after fopen(), in AppenderFile, but still cannot create..
>>>>
>>>>
>>>>
>>>> Christian grobmeier wrote:
>>>>>
>>>>> Does your script have write permission in this folder?
>>>>> Your webserver probably does not have the same user as you have
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> hi,
>>>>>>
>>>>>> the file path is correct, i am on linux..
>>>>>>
>>>>>> my php file is in my:
>>>>>> /var/www/html/Logging/loggingSamples/logtry.php
>>>>>>
>>>>>> while the logfile that i supposedly would create is in
>>>>>> /var/www/html/logs/
>>>>>>
>>>>>> the value of the filename in line 69 is:
>>>>>> /var/www/html/logs/20110104.log
>>>>>>
>>>>>> it has successfully set the filename though...
>>>>>>
>>>>>> did i missed out on something?
>>>>>>
>>>>>> thanks a lot..
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Christian grobmeier wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> thats weird. It should do as you wrote.
>>>>>>> You could check if the file paths comes through correct.
>>>>>>> Open the FileAppender and put an echo at line 69:
>>>>>>> http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php?view=markup
>>>>>>> Check if the folder can be opened and you have access to write
to it
>>>>>>> (what OS are u using?)
>>>>>>>
>>>>>>> In windows world you probably need C:\ or something before the
path
>>>>>>> begins
>>>>>>>
>>>>>>> My feeling says, its something related to that - either the filename
>>>>>>> param comes to the appender or the path is not correct (because
its
>>>>>>> used different from php maybe)
>>>>>>>
>>>>>>> Cheers
>>>>>>>
>>>>>>> On Tue, Jan 4, 2011 at 8:28 AM, tinkee <lee.tinki.tinki@gmail.com>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Hi!
>>>>>>>>
>>>>>>>> thanks a lot for the reply!
>>>>>>>> i've figured out the problem already, i think in the fopen
part of
>>>>>>>> Logger.php
>>>>>>>> it could not create the file.
>>>>>>>>
>>>>>>>> Because i tried to create an empty file with the same title
as the
>>>>>>>> filename
>>>>>>>> that i set in my xml,
>>>>>>>> it successfully wrote on the logfile! i read that fopen(),
would
>>>>>>>> supposedly
>>>>>>>> create an unexisting file
>>>>>>>> if "w" is specified in the second param. i tried it and i
could not
>>>>>>>> get
>>>>>>>> it
>>>>>>>> to work.. if i dont create a file
>>>>>>>> in the path i specified, it could not create the file successfully.
>>>>>>>>
>>>>>>>> have an idea how to do it? :(
>>>>>>>>
>>>>>>>> thanks a lot.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Christian grobmeier wrote:
>>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> http://logging.apache.org/log4php/docs/appenders.html#LoggerAppenderDailyFile
>>>>>>>>> there is some more which needs to be configured:
>>>>>>>>>
>>>>>>>>> log4php.appender.default.datePattern = Ymd
>>>>>>>>> log4php.appender.default.file = target/examples/daily_%s.log
>>>>>>>>>
>>>>>>>>> In your case it should look like:
>>>>>>>>>
>>>>>>>>> <appender name="logged_it" class='LoggerAppenderDailyFile'>
>>>>>>>>> <layout class="LoggerLayoutTTCC" />
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  </appender>
>>>>>>>>>
>>>>>>>>> Or similar
>>>>>>>>>
>>>>>>>>> However, I just reckognized that the xml documentation
is far from
>>>>>>>>> good. Its no surprise its usage is unclear.
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Christian
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Jan 4, 2011 at 3:24 AM, tinkee <lee.tinki.tinki@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> hi,
>>>>>>>>>>
>>>>>>>>>> i'm using the log4php for my logging.
>>>>>>>>>> specifically the LoggerAppenderDailyFile
>>>>>>>>>> but it could not create the logfile successfully.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> myconfig.xml -->resides in the same level with
my php file
>>>>>>>>>> --------------------------------------------------------------------
>>>>>>>>>> log4php:configuration
>>>>>>>>>> xmlns:log4php="http://logging.apache.org/log4php/"
>>>>>>>>>> >
>>>>>>>>>>    <appender name="logged_it" class='LoggerAppenderDailyFile'>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>        <layout class="LoggerLayoutTTCC">
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>        </layout>
>>>>>>>>>>    </appender>
>>>>>>>>>>    <root>
>>>>>>>>>>        <level value="debug" />
>>>>>>>>>>        <appender_ref ref="logged_it" />
>>>>>>>>>>    </root>
>>>>>>>>>> </log4php:configuration>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> the php file is this:
>>>>>>>>>> <?php
>>>>>>>>>>
>>>>>>>>>> require_once ('../log4php/php/Logger.php');
>>>>>>>>>> Logger::configure('myconfig.xml');
>>>>>>>>>>
>>>>>>>>>> //for checking
>>>>>>>>>> $temp = "hello there!";
>>>>>>>>>> echo $temp;
>>>>>>>>>>
>>>>>>>>>> $logger = Logger::getLogger('myLogger');   -->what
should be
>>>>>>>>>> specified
>>>>>>>>>> here
>>>>>>>>>> in getLogger?
>>>>>>>>>>                                  
                       -->a
>>>>>>>>>> random
>>>>>>>>>> value
>>>>>>>>>> is assigned here
>>>>>>>>>> $logger->debug('Hello!');
>>>>>>>>>>
>>>>>>>>>> ?>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> did i miss out on somehting?
>>>>>>>>>>
>>>>>>>>>> my php version is php5.1.X
>>>>>>>>>> and im using the log4php 2.0.0-incubating.
>>>>>>>>>>
>>>>>>>>>> does the version has any effect?
>>>>>>>>>>
>>>>>>>>>> thanks a lot.
>>>>>>>>>> --
>>>>>>>>>> View this message in context:
>>>>>>>>>> http://old.nabble.com/log4php-not-working-properly-tp30583406p30583406.html
>>>>>>>>>> Sent from the Log4php - Users mailing list archive
at Nabble.com.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> http://www.grobmeier.de
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://old.nabble.com/log4php-not-working-properly-tp30583406p30584450.html
>>>>>>>> Sent from the Log4php - Users mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> http://www.grobmeier.de
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/log4php-not-working-properly-tp30583406p30584545.html
>>>>>> Sent from the Log4php - Users mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> http://www.grobmeier.de
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/log4php-not-working-properly-tp30583406p30584645.html
>>> Sent from the Log4php - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> http://www.grobmeier.de
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/log4php-not-working-properly-tp30583406p30584779.html
Sent from the Log4php - Users mailing list archive at Nabble.com.


Mime
View raw message