1

I am using maven to import external dependency BrowserMob Proxy into my Java project:

       <dependency>
    <groupId>net.lightbody.bmp</groupId>
    <artifactId>browsermob-core-littleproxy</artifactId>
    <version>2.1.0-beta-3</version>
   </dependency>

However, when I am using this library it is VERY verbose in the output at the DEBUG level, to the point where I can barely see what my program is doing. How can I reduce the amount of output this library produces? I am basically seeing a lot of this:

[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Wrote: DefaultHttpContent(data: SimpleLeakAwareByteBuf(SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024))), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Not closing server connection on middle chunk for /renderer/vapi/current/v.js
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Not closing client connection on middle chunk for /renderer/vapi/current/v.js
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ProxyToServerConnection] (AWAITING_CHUNK) [id: 0x1e7ff722, L:/10.140.210.128:54478 - R:usweb.dotomi.com/23.215.104.50:80]: Reading: DefaultHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Retaining reference counted message
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Writing: DefaultHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Wrote: DefaultHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Not closing server connection on middle chunk for /renderer/vapi/current/v.js
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Not closing client connection on middle chunk for /renderer/vapi/current/v.js
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ProxyToServerConnection] (AWAITING_CHUNK) [id: 0x1e7ff722, L:/10.140.210.128:54478 - R:usweb.dotomi.com/23.215.104.50:80]: Reading: DefaultHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Retaining reference counted message
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Writing: DefaultHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Wrote: DefaultHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Not closing server connection on middle chunk for /renderer/vapi/current/v.js
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Not closing client connection on middle chunk for /renderer/vapi/current/v.js
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ProxyToServerConnection] (AWAITING_CHUNK) [id: 0x1e7ff722, L:/10.140.210.128:54478 - R:usweb.dotomi.com/23.215.104.50:80]: Reading: DefaultHttpContent(data: SlicedAbstractByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
[2018-04-09 15:04:40] [DEBUG] [LittleProxy-0-ProxyToServerWorker-1] [o.l.p.i.ClientToProxyConnection] (AWAITING_INITIAL) [id: 0x22000b92, L:/10.140.210.128:54435 - R:/10.140.210.128:54470]: Retaining reference counted message
Tschallacka
  • 24,188
  • 10
  • 79
  • 121
pete
  • 73
  • 7
  • first result when googling browsemob disable logging https://github.com/lightbody/browsermob-proxy/blob/master/browsermob-dist/src/main/resources/bmp-logging.yaml – Tschallacka Apr 09 '18 at 20:39
  • @Tschallacka that only works for standalone mode, I'm running in embedded mode. – pete Apr 09 '18 at 20:55

1 Answers1

3

Here's a similar question with a solution. Would that work for your needs? It works by directing the System.out to '/dev/null' or a file (logFile) and then setting it back to the console when you are done.

Here is the code snippet from the question for reference:

PrintStream stdout = System.out;
System.setOut(new PrintStream(logFile));

// ...

System.setOut(stdout);  
mike
  • 31
  • 4