Clean logging of response from apache HttpClient (without 15:44:59.689 [http-nio-8080-exec-4] DEBUG org.apache.http.wire - http-outgoing-0 <<) -
i managed turn on full debug logging on httpclient. (using logback) log indeed adds lot of garbage headers on every line. have logging without formatting, semicolons, quotes, encodings this:
15:44:59.689 [http-nio-8080-exec-4] debug org.apache.http.wire - http-outgoing-0 << " <readonly>false</readonly>[\n]" 15:44:59.689 [http-nio-8080-exec-4] debug org.apache.http.wire - http-outgoing-0 << " <enabled>false</enabled>[\n]" 15:44:59.689 [http-nio-8080-exec-4] debug org.apache.http.wire - http-outgoing-0 << " <metadata>[\n]" 15:44:59.689 [http-nio-8080-exec-4] debug org.apache.http.wire - http-outgoing-0 << " <name>p[0xc5][0x99]ipoji[0xc5][0xa1]t[0xc4][0x9b]n[0xc3][0xad] denn[0xc3][0xad] d[0xc3][0xa1]vky p[0xc5][0x99]i pobytu v nemocnici n[0xc3][0xa1]sledkem [0xc3][0xba]razu d[0xc3][0xad]t[0xc4][0x9b]te</name>[\n]" simply if there valid xml logged in, want copy paste whole chunk of log file favorite xml editor , see same data what came on wire. there way how achieve ? i'm fine extending classes apache.
it looks log lines you're trying modify being generated org.apache.http.impl.conn.loggingsessioninputbuffer class, in turn calls org.apache.http.impl.conn.wire log incoming data wire log.
unfortunately, wire class including less-than symbols , quotes in logged message, best logback use minimal pattern layout in logback.xml like
<pattern>%m%n</pattern> which should yield this:
<< " <readonly>false</readonly>[\n]" << " <enabled>false</enabled>[\n]" << " <metadata>[\n]" << " <name>p[0xc5][0x99]ipoji[0xc5][0xa1]t[0xc4][0x9b]n[0xc3][0xad] denn[0xc3][0xad] d[0xc3][0xa1]vky p[0xc5][0x99]i pobytu v nemocnici n[0xc3][0xa1]sledkem [0xc3][0xba]razu d[0xc3][0xad]t[0xc4][0x9b]te</name>[\n]" since still gives more like, maybe easier approach write little sed script grab quoted message , remove bracketed newline characters @ end.
Comments
Post a Comment