workerman
workerman copied to clipboard
How to suppress or send to file all output under Windows for single worker?
Subj.
I used fclose(STDOUT);
but I think it's wrong way.
Thanx.
Worker man doesn't provide the option to redirect output for windows, but you can do it by changing the code.
https://github.com/walkor/workerman/blob/7370cfc9c09f58ab5f4e9593d23ac6069930a570/Worker.php#L1457-L1459
Change codes
$descriptorspec = array(
STDIN, STDOUT, STDOUT
);
to
$std_file = 'your/path/of/stdout_file';;
$descriptorspec = array(
STDIN,
array('file', $std_file, 'w'), // stdout
array('file', $std_file, 'w') // stderr
);