[wsf-c-dev] [php] Call log from PHP Scripts

Samisa Abeysinghe samisa at wso2.com
Sun Apr 6 00:42:49 PDT 2008


Dimuthu Gamage wrote:
> Samisa Abeysinghe wrote:
>> Dimuthu Gamage wrote:
>>> Looks like finally we agreed on this, I will raise a JIRA and 
>>> suggest possible API.
>>
>> No I do not think we have agreed on this. You reply to my mail, and 
>> before I reply you call it "agreed upon". That is not right :)
>>
>> In your original mail you said:
>> "Currently we don't have proper way of logging from PHP Scripts. 
>> Currently We are using error_log function which write logs in apache. 
>> but we should write log to wsf_php_server.log and wsf_php_client.log 
>> so users are not confused.
>>
>> Shall we  implement wrapper for axis2_log_write function for use in 
>> PHP? "
>>
>> Now, there is no mention of "internal only" use as you mention in 
>> "Not really, Since we don't expect users to use this function in 
>> their code. Rather we used it in internal stuff.".
>>
>> So I do not think you have explained the requirement right in the 
>> first place.
>>
>> Here are my questions:
>> 1. Is this an internal only function?
> Yea, the purpose of putting it there is only to use in internal php 
> code, like wsdl mode handling and may be in wsdl generation.
>
>> 2. Where is this placed?
> It is placed in the wsf.c
>> 3. How can we "hide" it form users so that they do not use it if it 
>> is internal only?
>
> No, we can't hide it technically, but we can hide by skipping 
> documenting on it. This is the technique we uses in other functions 
> defined in script directory too. since inside some calls to wsf/php 
> function the files like wsf.php and wsf_wsdl.php are included with all 
> their functions, for an example all function defined in wsf.php
>
> function wsf_process_wsdl($user_parameters, $function_parameters);
> function wsf_process_response($response_payload_string, 
> $response_sig_model_string, $response_parameters, $wsdldom_string)
> function wsf_process_wsdl_for_service($parameters, $operation_array)
> function wsf_wsdl_process_in_msg($parameters)
>
> And functions defined in all other .php files in the script directory 
> are too exposed to the users. But we don't expect users to use them 
> simply by not documenting it.
>
> So I think wsf_error_log will be one of the function like that, which 
> can be easily removed whenever we remove the scripts directory and 
> replace it with the 'C' implementation.

OK, I get the point. So I am +1 to add the function. However, I think it 
would be better to document this and mention clearly that this is a 
debug function. Because by the looks of it, and looking at the past 
forum posts by the users, there may be times that we may have to ask the 
users to use this function and let us know what it wrote to the log. 
Because, in the debugging phase, we often tend to ask PHP users to send 
us the "C" logs.

Also, I would like to propose, that all log entries added through this 
function has a unique prefix, that would indicate that it came form a 
script and not form a C file.

Thanks,
Samisa...



>
>
> And when it comes to validate some XML with a schema, the log should 
> have all the error information. Even in WSDL2C code generation users 
> are expected to find the errors in their messages with the help of the 
> log. So a proper way of logging validation stuff is really critical. 
> That is why I suggested this approach.
>
>
> BTW I was wrong by saying 'Looks like we agreed on this'. sorry about 
> that. I just created the jira on the suggestions 
> https://wso2.org/jira/browse/WSFPHP-260 and didn't commit the changes 
> until we all agree.
>
> Thanks
> Dimuthu
>
>>
>> Thanks,
>> Samisa...
>>
>>>
>>> Thanks
>>> Dimuthu
>>>
>>> Dimuthu Gamage wrote:
>>>>
>>>> Samisa Abeysinghe wrote:
>>>>> Dimuthu Gamage wrote:
>>>>>> Hi samisa,
>>>>>>
>>>>>> I think error_log function is a standard function which write 
>>>>>> logs in to the apache server log (error.log), If we use that , 
>>>>>> for a trouble of a user, he need to attach all 3 files to figure 
>>>>>> out the error. That's why I suggested to limit to those 2, 
>>>>>> wsf_php_client.log and wsf_php_server.log
>>>>>
>>>>> Ok, I understand your concern. However, my question is, PHP users 
>>>>> are used to use error_log. If we come up with a new function, it 
>>>>> is adding additional burden, meaning, it adds complications in 
>>>>> terms of PHP user, inst it?
>>>>
>>>> Not really, Since we don't expect users to use this function in 
>>>> their code. Rather we used it in internal stuff. And I saw that 
>>>> AXIS2_LOG_ERROR is used inside wsf/php c code. It means we have 
>>>> been using it throughout the wsf/php. So there won't be different 
>>>> in logging php scripts stuff to the same log. And in a time php 
>>>> scripts is replaced with c implementation there won't be different 
>>>> in logs. So I think we should go with having a wrapper for the 
>>>> axis2_log_write.
>>>>
>>>>
>>>> Thanks
>>>> Dimuthu
>>>>
>>>>>
>>>>> Samisa...
>>>>>
>>>>>>
>>>>>> Thanks
>>>>>> Dimuthu
>>>>>>
>>>>>> Samisa Abeysinghe wrote:
>>>>>>> Dimuthu Gamage wrote:
>>>>>>>> Hi,
>>>>>>>> Currently we don't have proper way of logging from PHP Scripts. 
>>>>>>>> Currently We are using error_log function which write logs in 
>>>>>>>> apache. but we should write log to wsf_php_server.log and 
>>>>>>>> wsf_php_client.log so users are not confused.
>>>>>>>>
>>>>>>>> Shall we  implement wrapper for axis2_log_write function for 
>>>>>>>> use in PHP?
>>>>>>>
>>>>>>> What is the standard way of looging stuff in PHP? If there is a 
>>>>>>> standard way, we should rather find a way to use that, becuase, 
>>>>>>> to me, wsf_php_server.log and wsf_php_client.log are C logs, but 
>>>>>>> rather PHP scripts should write to PHPish logs.
>>>>>>>
>>>>>>> Samisa...
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Wsf-c-dev mailing list
>>>>>>> Wsf-c-dev at wso2.org
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Wsf-c-dev mailing list
>>>>>> Wsf-c-dev at wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Wsf-c-dev mailing list
>>>> Wsf-c-dev at wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>>>>
>>>
>>>
>>> _______________________________________________
>>> Wsf-c-dev mailing list
>>> Wsf-c-dev at wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>>>
>>>
>>
>>
>
>
> _______________________________________________
> Wsf-c-dev mailing list
> Wsf-c-dev at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>
>


-- 
Samisa Abeysinghe 
Software Architect; WSO2 Inc.

http://www.wso2.com/ - "Oxygenating the Web Service Platform."




More information about the Wsf-c-dev mailing list