[jira] [Commented] (CXF-8365) LoggingInInterceptor could not be extended / logs only once

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (CXF-8365) LoggingInInterceptor could not be extended / logs only once

Colm O hEigeartaigh (Jira)

    [ https://issues.apache.org/jira/browse/CXF-8365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17229033#comment-17229033 ]

Lars Uffmann commented on CXF-8365:

Hi Freeman,

yes, overriding org.apache.cxf.ext.logging.LoggingInInterceptor but might be the only way to workaround these issue in the short term.

I opened a Bug since we (and others) might as well have created two instances of LoggingInInterceptor, which is the actual intent of the override:

LoggingInInterceptor first = new LoggingInInterceptor(new Slf4jVerboseEventSender());
LoggingInInterceptor second = new LoggingInInterceptor(new MyCustomLogEventSender());

The change in 8257 is quite subtle and might go unnoticed for a long time. I think It would  be better to revert the change made and restore the original behaviour. Or refine the key LOGGIN_EVENT_PROP to be unique per instance of LoggingInInterceptor. What do you think?


Best Regards,


> LoggingInInterceptor could not be extended / logs only once
> -----------------------------------------------------------
>                 Key: CXF-8365
>                 URL: https://issues.apache.org/jira/browse/CXF-8365
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime, logging
>    Affects Versions: 3.4.0
>            Reporter: Lars Uffmann
>            Assignee: Freeman Yue Fang
>            Priority: Major
> Coming with CXF-8257 {{org.apache.cxf.ext.logging.LoggingInInterceptor}} will log a given message only once:
> {code:java}
> public void handleMessage(Message message) throws Fault {
>     if (isLoggingDisabledNow(message)) {
>         return;
>     } else {
>         //ensure only logging once for a certain message
>         //this can prevent message logging again when fault
>         //happen after PRE_INVOKE phase(rewind calls into LoggingInFaultInterceptor)
>         message.put(LIVE_LOGGING_PROP, Boolean.FALSE);
>     }
> {code}
> Filtering is done per message, not per Interceptor instance. We use a custom {{MyLoggingInInterceptor}} which subclasses the {{LoggingInInterceptor}}. (We Subclass in order to use different {{LogEventSender).}} So two distinct interceptor instances are applied to the Endpoint/Bus/Client but the message is logged only in the first invocation.

This message was sent by Atlassian Jira