You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christian Schneider <ch...@die-schneider.net> on 2016/03/01 00:21:24 UTC
Re: LoggingInInterceptor consuming time for big messages
Also take a look at the new LoggingFeature. It allows to tweak the logging
for each service at runtime and you can also limit the max body size to be
logged.
See:
https://github.com/apache/cxf/tree/master/rt/features/logging
http://liquid-reality.de/display/liquid/2015/06/08/Enterprise+ready+request+logging+with+CXF+3.1.0+and+elastic+search
Christian
2016-02-29 14:22 GMT+01:00 rohandm <ro...@gmail.com>:
> We are currently using LoggingInInterceptor/LoggingOutInterceptor to log
> soap
> messages in our application however these interceptors takes a significant
> amount of time especially on the IOUtils.copy(is, bos) call. Is their any
> way to call this part of the code in a separate thread without having the
> InputStream closed on us or Are there any other alternatives to improve
> performance here?
>
>
> InputStream is = message.getContent(InputStream.class);
> if (is != null) {
> CachedOutputStream bos = new CachedOutputStream();
> try {
> IOUtils.copy(is, bos);
>
> bos.flush();
> is.close();
>
> message.setContent(InputStream.class,
> bos.getInputStream());
> if (bos.getTempFile() != null) {
> //large thing on disk...
> buffer.getMessage().append("\nMessage (saved to tmp
> file):\n");
> buffer.getMessage().append("Filename: " +
> bos.getTempFile().getAbsolutePath() + "\n");
> }
> if (bos.size() > limit) {
> buffer.getMessage().append("(message truncated to " +
> limit + " bytes)\n");
> }
> writePayload(buffer.getPayload(), bos, encoding, ct);
>
> bos.close();
> } catch (Exception e) {
> throw new Fault(e);
> }
> }
> log(buffer.toString());
>
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/LoggingInInterceptor-consuming-time-for-big-messages-tp5766419.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
--
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>
Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>