This repository was archived by the owner on Dec 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
universal/src/main/java/com/msopentech/thali/toronionproxy Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -461,7 +461,10 @@ private Process spawnTorProcess() throws IOException {
461
461
LOG .warn (e .toString (), e );
462
462
throw new IOException (e );
463
463
}
464
- eatStream (torProcess .getErrorStream ());
464
+ eatStream (torProcess .getErrorStream (), true );
465
+ if (getContext ().getSettings ().hasDebugLogs ()) {
466
+ eatStream (torProcess .getInputStream (), false );
467
+ }
465
468
return torProcess ;
466
469
}
467
470
@@ -504,16 +507,20 @@ private void waitForCookieAuthFileCreation(File cookieAuthFile) throws IOExcepti
504
507
LOG .info ("Created cookie auth file: time = " + (System .currentTimeMillis () - cookieAuthStartTime ) + "ms" );
505
508
}
506
509
507
- private void eatStream (final InputStream inputStream ) {
510
+ private void eatStream (final InputStream inputStream , boolean isError ) {
508
511
new Thread () {
509
512
@ Override
510
513
public void run () {
511
514
Scanner scanner = new Scanner (inputStream );
512
515
try {
513
516
while (scanner .hasNextLine ()) {
514
- String error = scanner .nextLine ();
515
- LOG .error (error );
516
- eventBroadcaster .broadcastException (error , new Exception ());
517
+ String line = scanner .nextLine ();
518
+ if (isError ) {
519
+ LOG .error (line );
520
+ eventBroadcaster .broadcastException (line , new Exception ());
521
+ } else {
522
+ LOG .info (line );
523
+ }
517
524
}
518
525
} finally {
519
526
try {
You can’t perform that action at this time.
0 commit comments