You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Nabeel <na...@wso2.com> on 2006/01/30 02:48:03 UTC

[Axis2] Re: Patch - addition to log implementaion

Sorry..missed the Axised prefix..

Nabeel wrote:

> Hi,
> log implementation is updated to have the following methods. and these 
> methods take variable number of arguments (work just like 
> printf,sprintf, etc). now you don't need to do a sprintf to create the 
> string and pass it to log write method. Pls review and commit if useful.
>
> AXIS2_F_LOG_DEBUG
> AXIS2_F_LOG_INFO
> AXIS2_F_LOG_ERROR
> AXIS2_F_LOG_WARNING
> AXIS_F_LOG_CRITICAL
>
> (for performance reasons and convenience, instead of using a switch, 
> seperate methods are written for different log levels)
> All these takes similar set of arguments
> (log,__FILE__,__LINE__,formated string)
>
> e.g.:
> AXIS2_F_LOG_INFO(log,__FILE__,__LINE__,"my info %s %d","test",1);
>
> this would log
> [info] xxx.c(nn) my info test 1
>
> files in the patch:
> modules/util/log.c
> modules/util/axis2_log_default.h
> include/axis2_log.h
>
> 3 booleans are defined to independently on/off debug/info/warning 
> logs. (log_level parameter may be removed if we go for this scheme. 
> AXIS2_LOG_WRITE macro works as it used to, but prints the file name 
> and  line number transparently.
> TODO (suggestions): read log configuations from an xml file
>             implement AXIS2_F_LOG_XML(log obj ,xml obj, formated string)
>             using a file descriptor instead of stderr (2) and keeping 
> previous log when the app restarts
>
> Thanks
> - Nabeel
>


[Axis2] Log API changed. Please use new macros in logging. [was:Re: Patch - addition to log implementaion]

Posted by Samisa Abeysinghe <sa...@gmail.com>.
Hi All,
    Log API has changed to make the logging as useful as possible to 
users. Please have a look at axis2_log.h for new macro set.
    There is a seperate macro for each log level.

    Many thanks to Nabeel for his help to get this working.
Samisa...

Nabeel wrote:

> Log levels are already defined as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, 
> etc. Since these enums are used in many places in the source code to 
> wrtie logs, I didn't want to change them with this patch.
>
> Ideally these enums should be changed to AXIS2_LOG_LEVEL_DEBUG, 
> AXIS2_LOG_LEVEL_INFO, etc and as you suggested, the functions should 
> be changed as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, etc.
>
> - Nabeel
>
> Samisa Abeysinghe wrote:
>
>> This is cool. BTW, why did you use _F_ in the function macro? any 
>> specific reason?
>> I would like it to read as AXIS2_LOG_DEBUG instead of AXIS2_F_LOG_DEBUG.
>> Thanks,
>> Samisa...
>>
>> Nabeel wrote:
>>
>>> Sorry..missed the Axised prefix..
>>>
>>> Nabeel wrote:
>>>
>>>> Hi,
>>>> log implementation is updated to have the following methods. and 
>>>> these methods take variable number of arguments (work just like 
>>>> printf,sprintf, etc). now you don't need to do a sprintf to create 
>>>> the string and pass it to log write method. Pls review and commit 
>>>> if useful.
>>>>
>>>> AXIS2_F_LOG_DEBUG
>>>> AXIS2_F_LOG_INFO
>>>> AXIS2_F_LOG_ERROR
>>>> AXIS2_F_LOG_WARNING
>>>> AXIS_F_LOG_CRITICAL
>>>>
>>>> (for performance reasons and convenience, instead of using a 
>>>> switch, seperate methods are written for different log levels)
>>>> All these takes similar set of arguments
>>>> (log,__FILE__,__LINE__,formated string)
>>>>
>>>> e.g.:
>>>> AXIS2_F_LOG_INFO(log,__FILE__,__LINE__,"my info %s %d","test",1);
>>>>
>>>> this would log
>>>> [info] xxx.c(nn) my info test 1
>>>>
>>>> files in the patch:
>>>> modules/util/log.c
>>>> modules/util/axis2_log_default.h
>>>> include/axis2_log.h
>>>>
>>>> 3 booleans are defined to independently on/off debug/info/warning 
>>>> logs. (log_level parameter may be removed if we go for this scheme. 
>>>> AXIS2_LOG_WRITE macro works as it used to, but prints the file name 
>>>> and  line number transparently.
>>>> TODO (suggestions): read log configuations from an xml file
>>>>             implement AXIS2_F_LOG_XML(log obj ,xml obj, formated 
>>>> string)
>>>>             using a file descriptor instead of stderr (2) and 
>>>> keeping previous log when the app restarts
>>>>
>>>> Thanks
>>>> - Nabeel
>>>>
>>>
>>>
>>
>>
>
>


Re: [Axis2] Re: Patch - addition to log implementaion

Posted by Nabeel <na...@wso2.com>.
Macro names are changed as indicated earlier and a test is also added to 
the patch. Pls review & commit.
Function Prototype
AXIS2_LOG_XXX(log,file,line,formated_string,...);

XXX stands for the log level
Example
AXIS2_LOG_DEBUG(log,__FILE__,__LINE__,"this  is a  test  %s","test123");

Note:
We wanted to get File name and line number transparently to the macros. 
(e.g. AXIS2_LOG_DEBUG(log,formated_string,...)) This can be done with 
UNIX using __VA_ARGS__ macro. But for windows, this macro is not found 
in VC versions <= 7.  would appreciate if someone  can  come up with a 
way to use variable number of arguments in macros in windows.
Thanks.

-Nabeel

Samisa Abeysinghe wrote:

> Oh yes, I missed that. We have to change this.
>
> Samisa...
>
> Nabeel wrote:
>
>> Log levels are already defined as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, 
>> etc. Since these enums are used in many places in the source code to 
>> wrtie logs, I didn't want to change them with this patch.
>>
>> Ideally these enums should be changed to AXIS2_LOG_LEVEL_DEBUG, 
>> AXIS2_LOG_LEVEL_INFO, etc and as you suggested, the functions should 
>> be changed as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, etc.
>>
>> - Nabeel
>>
>> Samisa Abeysinghe wrote:
>>
>>> This is cool. BTW, why did you use _F_ in the function macro? any 
>>> specific reason?
>>> I would like it to read as AXIS2_LOG_DEBUG instead of 
>>> AXIS2_F_LOG_DEBUG.
>>> Thanks,
>>> Samisa...
>>>
>>> Nabeel wrote:
>>>
>>>> Sorry..missed the Axised prefix..
>>>>
>>>> Nabeel wrote:
>>>>
>>>>> Hi,
>>>>> log implementation is updated to have the following methods. and 
>>>>> these methods take variable number of arguments (work just like 
>>>>> printf,sprintf, etc). now you don't need to do a sprintf to create 
>>>>> the string and pass it to log write method. Pls review and commit 
>>>>> if useful.
>>>>>
>>>>> AXIS2_F_LOG_DEBUG
>>>>> AXIS2_F_LOG_INFO
>>>>> AXIS2_F_LOG_ERROR
>>>>> AXIS2_F_LOG_WARNING
>>>>> AXIS_F_LOG_CRITICAL
>>>>>
>>>>> (for performance reasons and convenience, instead of using a 
>>>>> switch, seperate methods are written for different log levels)
>>>>> All these takes similar set of arguments
>>>>> (log,__FILE__,__LINE__,formated string)
>>>>>
>>>>> e.g.:
>>>>> AXIS2_F_LOG_INFO(log,__FILE__,__LINE__,"my info %s %d","test",1);
>>>>>
>>>>> this would log
>>>>> [info] xxx.c(nn) my info test 1
>>>>>
>>>>> files in the patch:
>>>>> modules/util/log.c
>>>>> modules/util/axis2_log_default.h
>>>>> include/axis2_log.h
>>>>>
>>>>> 3 booleans are defined to independently on/off debug/info/warning 
>>>>> logs. (log_level parameter may be removed if we go for this 
>>>>> scheme. AXIS2_LOG_WRITE macro works as it used to, but prints the 
>>>>> file name and  line number transparently.
>>>>> TODO (suggestions): read log configuations from an xml file
>>>>>             implement AXIS2_F_LOG_XML(log obj ,xml obj, formated 
>>>>> string)
>>>>>             using a file descriptor instead of stderr (2) and 
>>>>> keeping previous log when the app restarts
>>>>>
>>>>> Thanks
>>>>> - Nabeel
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Re: [Axis2] Re: Patch - addition to log implementaion

Posted by Samisa Abeysinghe <sa...@gmail.com>.
Oh yes, I missed that. We have to change this.

Samisa...

Nabeel wrote:

> Log levels are already defined as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, 
> etc. Since these enums are used in many places in the source code to 
> wrtie logs, I didn't want to change them with this patch.
>
> Ideally these enums should be changed to AXIS2_LOG_LEVEL_DEBUG, 
> AXIS2_LOG_LEVEL_INFO, etc and as you suggested, the functions should 
> be changed as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, etc.
>
> - Nabeel
>
> Samisa Abeysinghe wrote:
>
>> This is cool. BTW, why did you use _F_ in the function macro? any 
>> specific reason?
>> I would like it to read as AXIS2_LOG_DEBUG instead of AXIS2_F_LOG_DEBUG.
>> Thanks,
>> Samisa...
>>
>> Nabeel wrote:
>>
>>> Sorry..missed the Axised prefix..
>>>
>>> Nabeel wrote:
>>>
>>>> Hi,
>>>> log implementation is updated to have the following methods. and 
>>>> these methods take variable number of arguments (work just like 
>>>> printf,sprintf, etc). now you don't need to do a sprintf to create 
>>>> the string and pass it to log write method. Pls review and commit 
>>>> if useful.
>>>>
>>>> AXIS2_F_LOG_DEBUG
>>>> AXIS2_F_LOG_INFO
>>>> AXIS2_F_LOG_ERROR
>>>> AXIS2_F_LOG_WARNING
>>>> AXIS_F_LOG_CRITICAL
>>>>
>>>> (for performance reasons and convenience, instead of using a 
>>>> switch, seperate methods are written for different log levels)
>>>> All these takes similar set of arguments
>>>> (log,__FILE__,__LINE__,formated string)
>>>>
>>>> e.g.:
>>>> AXIS2_F_LOG_INFO(log,__FILE__,__LINE__,"my info %s %d","test",1);
>>>>
>>>> this would log
>>>> [info] xxx.c(nn) my info test 1
>>>>
>>>> files in the patch:
>>>> modules/util/log.c
>>>> modules/util/axis2_log_default.h
>>>> include/axis2_log.h
>>>>
>>>> 3 booleans are defined to independently on/off debug/info/warning 
>>>> logs. (log_level parameter may be removed if we go for this scheme. 
>>>> AXIS2_LOG_WRITE macro works as it used to, but prints the file name 
>>>> and  line number transparently.
>>>> TODO (suggestions): read log configuations from an xml file
>>>>             implement AXIS2_F_LOG_XML(log obj ,xml obj, formated 
>>>> string)
>>>>             using a file descriptor instead of stderr (2) and 
>>>> keeping previous log when the app restarts
>>>>
>>>> Thanks
>>>> - Nabeel
>>>>
>>>
>>>
>>
>>
>
>


Re: [Axis2] Re: Patch - addition to log implementaion

Posted by Nabeel <na...@wso2.com>.
Log levels are already defined as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, etc. 
Since these enums are used in many places in the source code to wrtie 
logs, I didn't want to change them with this patch.

Ideally these enums should be changed to AXIS2_LOG_LEVEL_DEBUG, 
AXIS2_LOG_LEVEL_INFO, etc and as you suggested, the functions should be 
changed as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, etc.

- Nabeel

Samisa Abeysinghe wrote:

> This is cool. BTW, why did you use _F_ in the function macro? any 
> specific reason?
> I would like it to read as AXIS2_LOG_DEBUG instead of AXIS2_F_LOG_DEBUG.
> Thanks,
> Samisa...
>
> Nabeel wrote:
>
>> Sorry..missed the Axised prefix..
>>
>> Nabeel wrote:
>>
>>> Hi,
>>> log implementation is updated to have the following methods. and 
>>> these methods take variable number of arguments (work just like 
>>> printf,sprintf, etc). now you don't need to do a sprintf to create 
>>> the string and pass it to log write method. Pls review and commit if 
>>> useful.
>>>
>>> AXIS2_F_LOG_DEBUG
>>> AXIS2_F_LOG_INFO
>>> AXIS2_F_LOG_ERROR
>>> AXIS2_F_LOG_WARNING
>>> AXIS_F_LOG_CRITICAL
>>>
>>> (for performance reasons and convenience, instead of using a switch, 
>>> seperate methods are written for different log levels)
>>> All these takes similar set of arguments
>>> (log,__FILE__,__LINE__,formated string)
>>>
>>> e.g.:
>>> AXIS2_F_LOG_INFO(log,__FILE__,__LINE__,"my info %s %d","test",1);
>>>
>>> this would log
>>> [info] xxx.c(nn) my info test 1
>>>
>>> files in the patch:
>>> modules/util/log.c
>>> modules/util/axis2_log_default.h
>>> include/axis2_log.h
>>>
>>> 3 booleans are defined to independently on/off debug/info/warning 
>>> logs. (log_level parameter may be removed if we go for this scheme. 
>>> AXIS2_LOG_WRITE macro works as it used to, but prints the file name 
>>> and  line number transparently.
>>> TODO (suggestions): read log configuations from an xml file
>>>             implement AXIS2_F_LOG_XML(log obj ,xml obj, formated 
>>> string)
>>>             using a file descriptor instead of stderr (2) and 
>>> keeping previous log when the app restarts
>>>
>>> Thanks
>>> - Nabeel
>>>
>>
>>
>
>


Re: [Axis2] Re: Patch - addition to log implementaion

Posted by Samisa Abeysinghe <sa...@gmail.com>.
This is cool. BTW, why did you use _F_ in the function macro? any 
specific reason?
I would like it to read as AXIS2_LOG_DEBUG instead of AXIS2_F_LOG_DEBUG.
Thanks,
Samisa...

Nabeel wrote:

> Sorry..missed the Axised prefix..
>
> Nabeel wrote:
>
>> Hi,
>> log implementation is updated to have the following methods. and 
>> these methods take variable number of arguments (work just like 
>> printf,sprintf, etc). now you don't need to do a sprintf to create 
>> the string and pass it to log write method. Pls review and commit if 
>> useful.
>>
>> AXIS2_F_LOG_DEBUG
>> AXIS2_F_LOG_INFO
>> AXIS2_F_LOG_ERROR
>> AXIS2_F_LOG_WARNING
>> AXIS_F_LOG_CRITICAL
>>
>> (for performance reasons and convenience, instead of using a switch, 
>> seperate methods are written for different log levels)
>> All these takes similar set of arguments
>> (log,__FILE__,__LINE__,formated string)
>>
>> e.g.:
>> AXIS2_F_LOG_INFO(log,__FILE__,__LINE__,"my info %s %d","test",1);
>>
>> this would log
>> [info] xxx.c(nn) my info test 1
>>
>> files in the patch:
>> modules/util/log.c
>> modules/util/axis2_log_default.h
>> include/axis2_log.h
>>
>> 3 booleans are defined to independently on/off debug/info/warning 
>> logs. (log_level parameter may be removed if we go for this scheme. 
>> AXIS2_LOG_WRITE macro works as it used to, but prints the file name 
>> and  line number transparently.
>> TODO (suggestions): read log configuations from an xml file
>>             implement AXIS2_F_LOG_XML(log obj ,xml obj, formated string)
>>             using a file descriptor instead of stderr (2) and keeping 
>> previous log when the app restarts
>>
>> Thanks
>> - Nabeel
>>
>
>