Segregate client and server logging

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Segregate client and server logging

Mohana Rao S V
In the existing `org.apache.cxf.ext.logging.LoggingFeature` implementation it
is possible to segregate the server jaxws/jaxrs logs and It would be nice to
enhance to feature to segregate server/client logs.

Ex:  Ideally application can have jaxrs Rest API at the same time it can
have rest-client integrations.

It would be nice to have separate for logging,  Of course, we can achieve
this by introducing custom LogEventSender but it would be nice if the CXF
framework having this as a built-in feature.  I would like to submit a PR if
this proposal is agreed upon.

Ref: https://cxf.apache.org/docs/message-logging.html



--
Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
Reply | Threaded
Open this post in threaded view
|

Re: Segregate client and server logging

Andriy Redko
Hello Mohana,

The CXF's `org.apache.cxf.ext.logging.LoggingFeature` can be used with JAX-WS servers
as well JAX-RS Endpoints and Clients (as per documentation [1]). Is it something you
have found to be insufficient to segregate client / server logs (at least, for JAX-RS)
or you have different idea in mind? May be some example(s) would help, thank you.

Best Regards,
    Andriy Redko

[1] https://cxf.apache.org/docs/message-logging.html

MRSV> In the existing `org.apache.cxf.ext.logging.LoggingFeature` implementation it
MRSV> is possible to segregate the server jaxws/jaxrs logs and It would be nice to
MRSV> enhance to feature to segregate server/client logs.

MRSV> Ex:  Ideally application can have jaxrs Rest API at the same time it can
MRSV> have rest-client integrations.

MRSV> It would be nice to have separate for logging,  Of course, we can achieve
MRSV> this by introducing custom LogEventSender but it would be nice if the CXF
MRSV> framework having this as a built-in feature.  I would like to submit a PR if
MRSV> this proposal is agreed upon.

MRSV> Ref: https://cxf.apache.org/docs/message-logging.html



MRSV> --
MRSV> Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html

Reply | Threaded
Open this post in threaded view
|

Re: Segregate client and server logging

Romain Manni-Bucau
Hi Andriy,

Guess it can be neat to add "client"/"server" (or new EventTypes) to just
have different parent loggers:
https://github.com/apache/cxf/blob/4b43096d1d79d3ba8e169eff1f09b38ea3ec929e/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/slf4j/Slf4jEventSender.java#L55

final String cat = "org.apache.cxf.services." + *[client|server.]* + event.
getPortTypeName().getLocalPart() + "." + event.getType();

to be concrete ;)

Then slf4j binding can be configure to split between client and server
properly.

That said, I suspect it can need the opposite, client+server in the same
file, so the reverse pattern, so it can need to be a configurable pattern
at the end (which has other benefit like putting it in the app namespace
instead of o.a.cxf.services) and being able to configure it per client
(even on the same service). So I'd make this category a feature config
personally.

Hope it makes sense.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le ven. 24 avr. 2020 à 04:34, Andriy Redko <[hidden email]> a écrit :

> Hello Mohana,
>
> The CXF's `org.apache.cxf.ext.logging.LoggingFeature` can be used with
> JAX-WS servers
> as well JAX-RS Endpoints and Clients (as per documentation [1]). Is it
> something you
> have found to be insufficient to segregate client / server logs (at least,
> for JAX-RS)
> or you have different idea in mind? May be some example(s) would help,
> thank you.
>
> Best Regards,
>     Andriy Redko
>
> [1] https://cxf.apache.org/docs/message-logging.html
>
> MRSV> In the existing `org.apache.cxf.ext.logging.LoggingFeature`
> implementation it
> MRSV> is possible to segregate the server jaxws/jaxrs logs and It would be
> nice to
> MRSV> enhance to feature to segregate server/client logs.
>
> MRSV> Ex:  Ideally application can have jaxrs Rest API at the same time it
> can
> MRSV> have rest-client integrations.
>
> MRSV> It would be nice to have separate for logging,  Of course, we can
> achieve
> MRSV> this by introducing custom LogEventSender but it would be nice if
> the CXF
> MRSV> framework having this as a built-in feature.  I would like to submit
> a PR if
> MRSV> this proposal is agreed upon.
>
> MRSV> Ref: https://cxf.apache.org/docs/message-logging.html
>
>
>
> MRSV> --
> MRSV> Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Segregate client and server logging

Andriy Redko
Hi Romain,

Thank you for the clarification, I think it would be pretty neat enhancement, such
contribution is much appreciated. Thanks!

Best Regards,
    Andriy Redko

RMB> Hi Andriy,


RMB> Guess it can be neat to add "client"/"server" (or new EventTypes) to just have different parent loggers:
RMB> https://github.com/apache/cxf/blob/4b43096d1d79d3ba8e169eff1f09b38ea3ec929e/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/slf4j/Slf4jEventSender.java#L55


RMB> final String cat = "org.apache.cxf.services." + *[client|server.]* + event.getPortTypeName().getLocalPart() + "." + event.getType();

RMB> to be concrete ;)


RMB> Then slf4j binding can be configure to split between client and server properly.


RMB> That said, I suspect it can need the opposite, client+server in the same file, so the reverse pattern, so it can
RMB> need to be a configurable pattern at the end (which has other benefit like putting it in the app namespace instead
RMB> of o.a.cxf.services) and being able to configure it per client (even on the same service). So I'd make this category a feature config personally.


RMB> Hope it makes sense.


RMB> Romain Manni-Bucau
RMB> @rmannibucau |  Blog | Old Blog | Github | LinkedIn | Book

RMB> Le ven. 24 avr. 2020 à 04:34, Andriy Redko <[hidden email]> a écrit :

RMB> Hello Mohana,

RMB>  The CXF's `org.apache.cxf.ext.logging.LoggingFeature` can be used with JAX-WS servers
RMB>  as well JAX-RS Endpoints and Clients (as per documentation [1]). Is it something you
RMB>  have found to be insufficient to segregate client / server logs (at least, for JAX-RS)
RMB>  or you have different idea in mind? May be some example(s) would help, thank you.

RMB>  Best Regards,
RMB>      Andriy Redko

RMB>  [1] https://cxf.apache.org/docs/message-logging.html

 MRSV>> In the existing `org.apache.cxf.ext.logging.LoggingFeature` implementation it
 MRSV>> is possible to segregate the server jaxws/jaxrs logs and It would be nice to
 MRSV>> enhance to feature to segregate server/client logs.

 MRSV>> Ex:  Ideally application can have jaxrs Rest API at the same time it can
 MRSV>> have rest-client integrations.

 MRSV>> It would be nice to have separate for logging,  Of course, we can achieve
 MRSV>> this by introducing custom LogEventSender but it would be nice if the CXF
 MRSV>> framework having this as a built-in feature.  I would like to submit a PR if
 MRSV>> this proposal is agreed upon.

 MRSV>> Ref: https://cxf.apache.org/docs/message-logging.html



 MRSV>> --
 MRSV>> Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html