axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Goncharov <>
Subject Re: changes to the axutil log functions
Date Mon, 10 Nov 2008 11:42:13 GMT
I created jira issue 1286 and attached the patch.
BR, Dmitry

Damitha Kumarage wrote:
> HI Dmitry,
>    I am interested in  reviewing the patch you mentioned on axutil 
> log. Please send it as an jira attachment.
> thanks,
> Damitha
> Dmitry Goncharov wrote:
>> Hi,
>> You can make axis to do logging the way you need w/o making changes 
>> in the axis code.
>> Have a look at util/src/log.c. Function 
>> axutil_log_impl_write_to_file() is used to do logging.
>> All you need to do is to make your own shared library with only one 
>> function: axutil_log_impl_write_to_file().
>> The function has to have the same signature as the one in 
>> util/src/log.c.
>> Then use LD_PRELOAD to preload this new library when starting you 
>> application.
>> That's it. The axis code will invoke you implementation of 
>> axutil_log_impl_write_to_file().
>> Your proposed fix to pass a FILE* instead of a filename has the same 
>> restrictions as the current code. It makes the client do logging the 
>> way library wants.
>> The library already provides the interface to do logging the way the 
>> client needs.
>> You can  allocate an instance of axutil_log_t and set and 
>> ops.write to your own functions.
>> The you can replace the log object in your env struct with your 
>> customized log object.
>> Unfortunately, axis doesn't use ops.write.
>> The correct fix would be to change util/src/log.c to use ops.write() 
>> and
>> I considered providing a patch, but finally decided not to (because 
>> the library maintainers dont seem to be willing to apply patches) and 
>> used the LD_PRELOAD method described above.
>> BR, Dmitry
>> Haszlakiewicz, Eric wrote:
>>> I have a need to use axis within an existing system that has it's own
>>> ways of opening/closing/rotating logs and I've found the existing axis
>>> log interfaces to be a bit lacking.  I have some patches, but before I
>>> submit a issue in jira I wanted to run the changes past some people to
>>> see if what I'm doing makes sense.
>>> There are two issues that I'm fixing:
>>>   1) the log functions don't keep track of whether the filedescriptor
>>> was opened by axis, so if you create a env using axutil_env_create() it
>>> ends up closing stderr when you try to set a new log file.
>>>   2) There's no way to tell axis to log to a filedescriptor rather than
>>> to a named file.
>>> I added two functions to axutil_log_default.h:
>>> One to create a axutil_log_t using an existing FILE * as returned from
>>> fopen:
>>>     AXIS2_EXTERN axutil_log_t *AXIS2_CALL
>>>     axutil_log_create_fp(
>>>         axutil_allocator_t *allocator,
>>>         axutil_log_ops_t *ops,
>>>         void *stream,
>>>         int close_stream);
>>> I also factored out a static axutil_log_create_common() function, which
>>> is used by both axutil_log_create_fp() and the original
>>> axutil_log_create().
>>> And, one to switch the FILE pointer on an existing log structure:
>>>     AXIS2_EXTERN void AXIS2_CALL
>>>     axutil_log_set_stream(
>>>         axutil_allocator_t *allocator,
>>>         axutil_log_t *log,
>>>         void *stream,
>>>         int close_stream);
>>> In both of these, the close_stream flag indicates whether axis is
>>> allowed to close the stream when a new one is set or when the log
>>> structure is cleaned up.  That is stored in a new field in the
>>> axutil_log_impl structure.
>>> Does this seem reasonable?  Should I send the full patch to the list?
>>> eric
>>> (btw, I created a couple of other jira issues (AXIS2C-1271, 
>>> AXIS2C-1280)
>>> w/ patches attached.  About how long can I expect before they are
>>> applied?)
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: 
>>> <>
>>> For additional commands, e-mail: 
>>> <>

View raw message