Re: changes to the axutil log functions

2008-11-10 Thread Dmitry Goncharov

Hi,
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 ops.free 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 ops.free().
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: [EMAIL PROTECTED] 

For additional commands, e-mail: [EMAIL PROTECTED] 



  





Re: changes to the axutil log functions

2008-11-09 Thread Damitha Kumarage

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 ops.free 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 ops.free().
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: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 

  



--
__

Damitha Kumarage
http://people.apache.org/
__

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: changes to the axutil log functions

2008-11-05 Thread Dmitry Goncharov
This is what i though when submitted a patch and it wasn't applied. Not 
intended to insult anybody. See jira issue 1258

BR, Dmitry

Samisa Abeysinghe wrote:

Dmitry Goncharov wrote:


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.


This is an incorrect statement. When were you told that we are not 
willing to accept patches? Have you ever submitted Jiras with patches?


Samisa...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: changes to the axutil log functions

2008-11-05 Thread Samisa Abeysinghe

Dmitry Goncharov wrote:


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.


This is an incorrect statement. When were you told that we are not 
willing to accept patches? Have you ever submitted Jiras with patches?


Samisa...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: changes to the axutil log functions

2008-11-05 Thread Manjula Peiris
On Wed, 2008-11-05 at 11:27 +0300, Dmitry Goncharov wrote:
> 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.

We apply the patches immediately which solves critical issues. The
patches you have sent may be critical fixes for you but may not be for
the community. Actually these patches will be applied when developers
get time to fix Jiras, most probably for a major release. So we always
encourage community to send patches, because at some time they will be
applied if they improve Axis2/C code base.


> 
> 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> >   


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: changes to the axutil log functions

2008-11-05 Thread Dmitry Goncharov

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 ops.free 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 
ops.free().
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


changes to the axutil log functions

2008-11-03 Thread Haszlakiewicz, Eric
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]