Skip to content

Commit 6f2e8da

Browse files
committed
Log stdout/stderr to server.log
1 parent ddbe1b5 commit 6f2e8da

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

browsermobproxy/server.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import os
2-
from subprocess import Popen, PIPE, STDOUT
2+
import platform
33
import socket
4+
import subprocess
45
import time
5-
import platform
6+
67
from client import Client
78

89

@@ -41,7 +42,10 @@ def start(self):
4142
This will start the browsermob proxy and then wait until it can
4243
interact with it
4344
"""
44-
self.process = Popen(self.command, stdout=PIPE, stderr=STDOUT)
45+
self.log_file = open(os.path.abspath('server.log'), 'w')
46+
self.process = subprocess.Popen(self.command,
47+
stdout=self.log_file,
48+
stderr=subprocess.STDOUT)
4549
count = 0
4650
while not self._is_listening():
4751
time.sleep(0.5)
@@ -64,6 +68,8 @@ def stop(self):
6468
# kill may not be available under windows environment
6569
pass
6670

71+
self.log_file.close()
72+
6773
@property
6874
def url(self):
6975
"""

0 commit comments

Comments
 (0)