You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Freeman Yue Fang (Jira)" <ji...@apache.org> on 2021/03/12 19:32:00 UTC

[jira] [Resolved] (CXF-8341) LoggingFeature always prints out binary contents

     [ https://issues.apache.org/jira/browse/CXF-8341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Yue Fang resolved CXF-8341.
-----------------------------------
    Fix Version/s: 3.4.3
                   3.5.0
       Resolution: Fixed

> LoggingFeature always prints out binary contents
> ------------------------------------------------
>
>                 Key: CXF-8341
>                 URL: https://issues.apache.org/jira/browse/CXF-8341
>             Project: CXF
>          Issue Type: Bug
>          Components: logging
>    Affects Versions: 3.4.0
>            Reporter: Luke
>            Assignee: Freeman Yue Fang
>            Priority: Major
>             Fix For: 3.5.0, 3.4.3
>
>
> As mentioned in the following (closed) old issue:
> https://issues.apache.org/jira/browse/CXF-7143
> it seems that the LoggingFeature and releated classes (LoggingInInterceptor, etc) don't treat correctly a SOAP MTOM message with multiple parts.
> Configuring the LoggingFeature as follows:
> {code:java}
> LoggingFeature lf = new LoggingFeature();
>         lf.setPrettyLogging(false);
>         lf.setLogBinary(false);
>         lf.setLogMultipart(true);
> {code}
> The MTOM attachment is printed in the log despite its content-type is application/octet-stream (already defined in the DefaultLogEventMapper).
> {code:java}
> ...
> HttpMethod: POST
>     Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:09d02828-bbcd-4ab7-9007-53cac8f6174d"; start="<ro...@cxf.apache.org>"; start-info="application/soap+xml"
> ...
> Payload: 
> --uuid:09d02828-bbcd-4ab7-9007-53cac8f6174d
> Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml"
> Content-Transfer-Encoding: binary
> Content-ID: <ro...@cxf.apache.org><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
> ...
> </soap:Body></soap:Envelope>
> --uuid:09d02828-bbcd-4ab7-9007-53cac8f6174d
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: binary
> Content-ID: <0c...@cxf.apache.org>
> Content-Disposition: attachment;name="pdf-sample.pdf"
> ---> THE BINARY CONTENT IS LOGGED HERE EVEN IF THE CONTENT TYPE IS application/octet-stream
> {code}
> It seems that the isBinaryContent() is evaluted only once for the whole message passing the content-type of the first part only (applcation/xop+xml).
> I would like to have printed in the log only the SOAP XML payload (the first part) filtering out the binary parts (replacing them with the standard message "--- Content suppressed ---").
> To recap, if I set LoggingFeature.setLogMultipart(false) also the SOAP XML Envelope disappear (as it is contained in a part), if I set LoggingFeature.setLogMultipart(true) and LoggingFeature.setLogBinary(false) the latter is ignored and the binary content are printed in the log.
> Any help would be highly appreciated.
> Luke
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)