sysout-over-slf4j icon indicating copy to clipboard operation
sysout-over-slf4j copied to clipboard

Partial redirection of System.out

Open ceki opened this issue 13 years ago • 2 comments

Hello,

I am trying to use sysout-over-slf4j in order to redirect SOAP messages printed by the com.sun.xml.ws.transport.http.client.HttpTransportPipe class on System.out. This class directly invokes the System.out.println(String) method which is redirected just fine. However, HttpTransportPipe also invokes the Ssytem.out.write((byte b[], int off, int len) method which unfortunately is not redirected. It turns out that data I am actually interested in is output in that invocation. Anyway, looking at the SLF4JPrintStreamImpl class the culprit seems to be:

264 @Override 265 public void write(final byte[] buf, final int off, final int len) { 266 originalPrintStream.write(buf, off, len); 267 }

For some reason, this method seems to invoke the original stream instead of redirecting to SLF4J. Could you please shed some light on the matter?

See also: http://projects.lidalia.org.uk/sysout-over-slf4j/xref/uk/org/lidalia/sysoutslf4j/system/SLF4JPrintStreamImpl.html#266

ceki avatar Nov 15 '10 08:11 ceki